(转)ubuntu下jthread 和jrtplib的安装

ubuntu12.04

1.       下载开发包解压。分别下载jrtplib-3.7.1.tar.gz和jthread-1.2.1.tar.gz。下载地址为:

http://research.edm.uhasselt.be/jori/jrtplib/jrtplib-3.7.1.tar.gz

http://research.edm.uhasselt.be/jori/jthread/jthread-1.2.1.tar.gz

2.       将源文件放到如下任意目录中,这里假设放到主目录下:/home/jrtplib/。分别解压#tar -xzvf xxx,xxx为文件名。解压后出现两个目录,一个是jrtplib-3.7.1,一个是jthread-1.2.1。然后进行安装,先安装jthread,再安装jrtplib,这里边保证安装的顺序为先安装jthread,在安装 jrtplib。

3.       jthread安装:进入jthead解压目录,首先,运行#./configure配置环境,生成makefile文件,如果出现permission denied,说明我们需要给文件configure执行的权限,运行#chmod a+x configure即可。配置好环境后,运行#make。make成功后,再运行#make install。安装成功以后会在/urs/local/include目录下多出一个文件夹jthread。

4.       jrtplib安装同上,全部安装好以后会在/urs/local/include目录下多出两个文件夹jrtplib3(可能由于版本不同,生成的文件夹名字略有不同,比如叫jrtplib-3.7.1)和jthead。复制jthead下所有文件(都是后缀为.h的头文件)到jrtplib文件夹下,目的是为了让所有头文件在一个目录下方便调用。

5.       装好以后系统环境如下,静态动态库安装到了/usr/local/lib目录下,包括libjrtplib-3.7.1.so和libjthread-1.2.1.so等。头文件在/usr/local/include/jrtplib-3.7.1目录下。

6.       在jrtplib源代码目录里有示例程序,在目录example下,试验一下编译example1.cpp,使用静态库libjrtp.a链接,编译链接语句如下(注意用g++而不是gcc编译,因为是链接阶段需要g++):
g++ -o example1 example1.cpp -I /usr/local/include/jrtplib/ -ljrtp
即生成应用程序exmaple1,注意,-I(大写的i)参数中路径为jrtplib头文件目录,根据实际情况修改。如果出现错误,说明动态链接库路径不对,有以下两种方法可以对动态链接库的路径进行设置:

a、修改动态链接库宏LD_LIBRARY_PATH。LD_LIBRARY_PATH 这个环境变量是大家最为熟悉的,它告诉loader:在哪些目录中可以找到共享库。可以设置多个搜索目录,这些目录之间用冒号分隔开。export LD_LIBRARY_PATH=/usr/local/lib,然后再运行编译,即可通过。这种方法只是暂时修改路径,在重启shell后会失效。或者是配置在环境变量文件/etc/profile中,重启或者source /etc/profile 生效,source 只在本控制台生效。

b、永久生效的方法为修改动态链接库配置文件/etc/ld.so.conf,或者在/etc/ld.so.conf.d里创建一个新文件,并把需要的目录加到这个文件里。具体方法如下:(说明:这种修改动态链接库配置的方式需要使用超级用户权限,不然没有对共享库配置文件的写权限)

#cd /etc/ld.so.conf.d

#vim jrtplib在编辑环境下加入/usr/local/lib,保存退出。

#ldconfig 重新加载动态链接库。

然后再执行编译链接,成功生成example1文件。

然后运行./example1。成功。

关于 jrtp 的一些说明:

说明 1 : jrtp 有两种数据接收方式:第一种是用 jthread 库提供的线程自动在后台执行对数据的接收。第二种是用户自己调用 RTPSession 中的 Poll 方法。如果采取第一种方法则要安装 jthread 库,则安装 jthread-1.2.1.tar.gz ,而且 jthread-1.2.1 必须先与 jrtp-3.7.1 的安装。因为在 jrtp-3.7.1 的 configure 中,会查找系统是否有编译了 jthread 库,如果有,那么编译的 jrtp 库会开启对 jthread 的支持。因此如果先编译jrtp 在编译 jthread ,编译出来的 jrtp 是没有开启对 jthread 的支持的。如果采用第二种方法,那么可以不用编译 jthread 库,而直接编译 jrtp 库。

jrtp-3.7.1.tar.gz 与 jthread-1.2.1.tar.gz 的下载地址

http://research.edm.uhasselt.be/~jori/page/index.php?n=CS.Jrtplib

一,编译为 PC 所用:

PS:./configure –help 可以查看一些可以配置选项

jthread-1.2.1 的编译

[[email protected] pc-jrtp]# tar -zxvf jthread-1.2.1.tar.gz

[[email protected] pc-jrtp]# cd jthread- 1.2.1

[[email protected] jthread-1.2.1]# ./configure  --prefix=/usr

[[email protected] jthread-1.2.1]# make

[[email protected] jthread-1.2.1]# make install

说明 : --prefix= 指定编译后的 jthread 库安装到什么目录 。

安装成功后在自己指定目录下有 : include 与 lib 两个文件夹

include 中又有一个 jthread 的文件夹,里面包含了 jthread 库的头文件

lib 中包含了编译成功的 jthread 库:包括 动态库 libjthread-1.2.1.so 与 静态库 libjthread.a

(2) jrtplib-3.7.1 的编译

[[email protected] pc-jrtp]# tar -zxvf jrtplib-3.7.1.tar.gz

[[email protected] pc-jrtp]# cd jrtplib- 3.7.1

[[email protected] pc-jrtp]# ./configure --prefix=/usr/local/ --with-jthread-includes=/usr/local/include/jthread LDFLAGS=-L/usr/local/lib

说明:

--prefix= --prefix :指定编译后的 jrtplib 库安装到什么目录。

--with-jthread-includes :指定之前安装的 jthread 库的头文件安装在什么目录下。如果不需要 jthread 的支持,这个选项可以不用。

LDFLAGS :为编译时需要连接的动态库的路径。如果不需要 jthread 库的支持,这个选项不要。

configure 过程中出现的提示信息:

checking for JThread include files... in "/opt/mini2440/pc-jrtp/include/jthread"

checking JThread version... >= 1.1.0

checking if we can link against jthread and pthread... yes

说明 jthread 路径正确,配置文件开启了对 jthread 的支持。

接着进行 make 与 make install

[[email protected] jrtplib-3.7.1]# make

[[email protected] jrtplib-3.7.1]# make install

在不修改源文件情况下 , make 的过程中直接编译可能出现的错误:

在 Fedora 9 中 make 提示的错误:

rtppacket.cpp:311: error: ‘memcpy‘ was not declared in this scope

或者:

在 Fedora 13 中 make 提示的错误:

rtperrors.cpp: In function ‘std::string RTPGetErrorString(int)‘:

rtperrors.cpp:225: error: ‘snprintf‘ was not declared in this scope

为了 make 成功,需要修改 jrtplib-3.7.1 源文件 rtpdefines.h

添加如下语句 : 
#include  
#include  
#include

操作如下:

[[email protected] jrtplib-3.7.1]# cd src/

[[email protected] src]# vim rtpdefines.h

// rtpdefines.h

75 #include

78 #if (defined(WIN32) || defined(_WIN32_WCE))

79         #if (!defined(_WIN32_WCE)) && (defined(_MSC_VER) && _MSC_VER >= 1400 )

80                 #define RTP_SNPRINTF _snprintf_s

81         #else

82                 #define RTP_SNPRINTF _snprintf

83         #endif

84 #else

85         #define RTP_SNPRINTF snprintf

86 #endif // WIN32 || _WIN32_WCE

重新 make 后可以成功。

安装成功后在自己指定目录下有 :include 与 lib 两个文件夹

include 中又有一个 jrtplib 的文件夹,里面包含了 jrtplib 库的头文件

lib 中包含了编译成功的 jrtp 库:包括 动态库 libjrtp-3.7.1.so 与 静态库 libjrtp.a 。

二,编译为 MINI2440(ARM) 所用 :

步骤与编译为 PC 所用一样,但是 configure 的设置过有所不同,现在说明:

(1) 对于 jthread

./configure  --prefix=/opt/mini2440/arm-jrtp –host=arm-linux CC=arm-linux-gcc CXX=arm-linux-g++

(2) 对于 jrtlib

./configure –prefix=/opt/mini2440/arm-jrtp –host=arm-linux –with-jthread-includes=/opt/mini2440/arm-jrtp/includes CC=arm-linux-gcc CXX=arm-linux LDFLAGS=-L/opt/mini2440/arm-jrtp/lib

然后会看到如下提示信息:

ASSUMING TARGET IS BIG ENDIAN:

The script detected a cross-compiler on your system. This can mean that

there really is a cross-compiler installed, or that for some other reason,

a simple program could not be run. You should check the config.log file

to verify this.

Since we are assuming a cross-compiler, we won‘t be able to actually test

any program. More important, we cannot test if the system is big or little

endian.

For now, big endian is assumed. If this assumption should be wrong, you will

have to comment the appropriate line in ‘rtpconfig_unix.h‘

说明 : configure 把目标平台默认为是大端模式。如果需要改变则要修改 rtpconfig_ unix.h 。

我们那么应该测试开发板是大端模式还是小端模式:

至于什么是大端模式,什么小端模式,以及为什么要测试请看我博客上的大端模式与小端模式。

测试程序:

1 #include

2 int main(void)

3 {

4         int num = 0x1234;

5         char *p = #

6         if (*p == 0x12){

7                 printf("Big Endian/n");

8         }

9         else{

10                 printf("Little Endian/n");

11         }

12         return 0;

13  }

保存后用交叉编译器编译生成可执行文件后,放到目标平台上执行。从而判断出目标平台是什么模式。

通过测试下,得知 MINI2440 默认为小端模式,因此需要修改 rtpconfig_ unix.h

文件在 :

/opt/mini2440/arm-jrtp/jrtplib-3.7.1/src

修改操作如下:

33 #ifndef RTPCONFIG_UNIX_H

34

35 #define RTPCONFIG_UNIX_H

36

37 // Don‘t have

38

39 // Don‘t have

40

41 //#define RTP_BIG_ENDIAN // comment this if the target is a little endian system

42

43 #define RTP_SOCKLENTYPE_UINT

则是把第 41 行注释了 。注释后则以小段模式来编译。

然后就可以 make 与 make install 了。

三,最后一步就是测试了:

(1) 首先把编译为 PC 所用的库文件: libjrtp-3.7.1.so 与 libjthread.so 复制到 Fedora9 的 /lib 。

(2) 把交叉编译后生成的库文件 :libjrtp-3.7.1.so 与 libjthread.so 复制到开发板上的 /lib 。

(3) 执行 /opt/mini2440/pc-jrtp/jrtp-3.7.1/example 下的 exampl4 。

[[email protected] examples]# ./example4

Enter local portbase:

9090

Number of seconds you wish to wait:

500

(4) 把 /opt/mini2440/arm-jrtp/jrtp-3.7.1/example 目录复制到开发板上并执行 exampl1 。

[[email protected] download]# ./example1

Enter local portbase:

9090

Enter the destination IP address

192.168.0.2

Enter the destination port

9090

Number of packets you wish to be sent:

50

(5) 如果在 PC 上出现 Got packet 则表示可以收到开发板发过来的数据包

Got packet 32390 from SSRC 609572025

Got packet 32391 from SSRC 609572025

…….

遇到的问题:

编译jrtplib的时候出现问题

rtperrors.cpp:206:1: warning: deprecated conversion from string constant to ‘cha
r*‘ [-Wwrite-strings]
rtperrors.cpp:206:1: warning: deprecated conversion from string constant to ‘cha
r*‘ [-Wwrite-strings]
rtperrors.cpp:206:1: warning: deprecated conversion from string constant to ‘cha
r*‘ [-Wwrite-strings]
rtperrors.cpp:206:1: warning: deprecated conversion from string constant to ‘cha
r*‘ [-Wwrite-strings]
rtperrors.cpp:206:1: warning: deprecated conversion from string constant to ‘cha
r*‘ [-Wwrite-strings]
rtperrors.cpp:206:1: warning: deprecated conversion from string constant to ‘cha
r*‘ [-Wwrite-strings]
rtperrors.cpp:206:1: warning: deprecated conversion from string constant to ‘cha
r*‘ [-Wwrite-strings]
rtperrors.cpp: In function ‘std::string RTPGetErrorString(int)‘:
rtperrors.cpp:225:36: error: ‘snprintf‘ was not declared in this scope
make[1]: *** [rtperrors.lo] 错误 1
make[1]:正在离开目录 `/home/chenyu/chenyu/jrtplib-3.7.1/src‘

make: *** [all-recursive] 错误 1

解决方法:src目录下找到rtpdefines.h文件,在里面加入:

#include <stdio.h> 
#include <stdarg.h> 
#include <string.h>

保存,再次编译,就可以了。。。。。。。。。。

参考:

1,ubuntu下jthread 和jrtplib的安装

http://blog.sina.com.cn/s/blog_712a04260101c2bm.html

2,编译jrtplib的时候出现问题

http://blog.csdn.net/chenyu123123/article/details/8743319

时间: 2024-08-09 07:40:20

(转)ubuntu下jthread 和jrtplib的安装的相关文章

ubuntu下针对php的thrift 安装折腾记录

此安装针对php开发配置 按照官方的文档做法,会出现各种bug,总结正确的安装方法: STEP1: 安装必要的依赖插件: sudo apt-get install libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev sudo apt-get install php5-dev php5-cli ph

Ubuntu下有道词典的安装

Ubuntu下有道词典的安装 支持Ubuntu 14.10以及以上版本,提供32位和64位安装包. 14.04用户需要在安装前更新系统(update&dist-upgrade) 安装方式: 1.打开更新管理器对Ubuntu系统进行更新: 2.下载与当前系统对应版本的安装包后,双击运行安装.

Ubuntu下icinga(nagios衍生版)安装步骤

Ubuntu下icinga安装步骤: http://sourceforge.net/projects/icinga-cn/files/icinga-cn/icinga-cn-1.11/icinga-cn-1.11.5.tar.gz/download http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz $ sudo useradd icinga $ sudo apt-get install libdbi-dev $ sudo

Ubuntu下ssh免密码登录安装

1.首先在本机安装openssh-server和openssh-client. 命令:sudo apt-get install openssh-server openssh-client 2.在检查当前的目录下有没有.ssh这个文件,没有的话就mkdir下. 3.生成公钥与私钥.命令:ssh-keygen -t rsa 4.将.ssh文件中的id_isa_pub复制到其他机器的authorized_keys下.并修改authorized_keys权限为600. 5.ssh nodeXX即可. U

Ubuntu下查看软件版本及安装位置【转】

Ubuntu下查看软件版本及安装位置 查看软件版本:     aptitude show xxx 也可用apt-show-versions (要先安装sudo apt-get install apt-show-versions) 查看软件安装位置:dpkg -L xxxx 查看软件是否安装:dpkg -l | grep filename

ubuntu下chromium浏览器flash插件安装

ubuntu下chromium浏览器默认是不支持flash的,在新立德软件包中搜索flash得到的“Adobe Flash Player plugin installer”也没有什么卵用,因为装完以后根本不知道怎么运行啊-摔-super中搜索不到!在终端里面执行sudo flashplugin-installer也说找不到命令- 解决办法: 安装pepperflashplugin-nonfree(注:它真的是免费的).通过新立德或者apt-get都可以. 想要图文并茂手把手教程的可以看这里: 如

Ubuntu下Snort从编译、安装到调试全过程

自:https://www.newbyter.net/?p=1403 一.编译 编译是在Ubuntu 11.04 (32bit)下完成的,Ubuntu采用默认安装方式. Snort本身用到了一些第三方的库,这些库默认在Ubuntu下并没有安装,因此需要我们自己手动安装.具体包括:libdnet-1.12.libpcap-1.0.0.pcre-8.12.zlib-1.2.5等,除此之外,还需要安装build-essential.flex和bison包. 这些第三方库的编译安装比较简单,一般只需要执

ubuntu 下如何在eclipse上安装部署发布tomcat

搞了半天终于搞定了,把心得写下来吧.真心感觉一般开发人员使用windows下面开发就够了,所谓的ubuntu安全性是服务器方面的,一般开发人员根本没法碰,不过还是有很多爱好者想弄弄,我也是其中之一哈. 介绍我的环境:ubuntu14.04       JDK1.7.0_79    tomcat7.0.69  eclipse3.4:j2ee 版 下面开始了:(可能有点啰嗦,我这里是想详细点,将就着看吧) 首先eclipse必须先安装好,没安装好的请参见下文,一定要注意:如果不懂安装,那就需要完全按

ubuntu下使用Tesseract-ocr(编译、安装、使用、训练新的语言库)

本文前半部分是来自http://www.qisanfen.com/?p=185的一篇文章,主要讲了安装.训练的大致流程,注意如果需要训练语言库需要把所需要的库安装完整 后半部分大致是官方wiki的翻译版本 如果只安装,不训练,可以看我的另一篇比较简洁的文章http://blog.csdn.net/yimingsilence/article/details/51276138 关于训练的具体细节可以查看官方wiki : https://github.com/tesseract-ocr/tessera