libnice编译

来源:互联网 发布:积分入学社保怎么算法 编辑:程序博客网 时间:2024/04/30 19:39

阅读源目录下的README :

Requirements
------------

 glib >= 2.10
 pkg-config
 gupnp-igd >= 0.1.2 (optional)
 gstreamer-0.10 >= 0.10.0 (optional)

Build instructions
------------------

 

编译LIBNICE(先简单配置,初步确定依赖条件)

# ./configure

checking for GLIB... no
configure: error: Package requirements (glib-2.0 >= 2.30 gio-2.0 >= 2.30 gobject-2.0 >= 2.30 gthread-2.0) were not met:

Requested 'glib-2.0 >= 2.30' but version of GLib is 2.28.8
Requested 'gio-2.0 >= 2.30' but version of GIO is 2.28.8
Requested 'gobject-2.0 >= 2.30' but version of GObject is 2.28.8

错误:CentOS release 6.5系统安装的glib不符合要求,版本太低

 

重新安装GLIB

# ./configure --with-libiconv=gnu --prefix=/home/xiongli/ LIBFFI_CFLAGS=-I/home/xiongli/lib/libffi-3.2.1/include/ LIBFFI_LIBS=-L/home/xiongli/lib64 PCRE_CFLAGS=-I/home/xiongli/include/ PCRE_LIBS=-L/home/xiongli/lib/ LIBS=-lpcre glib_cv_pcre_has_unicode=yes --enable-static=yes

# make

*我们这里安装到/home/xiongli/,不覆盖系统原有的。

*错误:gconvert.c:59:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv。 设置选项--with-libiconv=gnu即可。

*这里我们也重新安装了libpcre, 因为提示系统自带的libpcre不支持unicode和utf属性,编译pcre时加两个选项--enable-unicode-properties --enable-utf8

 

第二次编译LIBNICE

# ./configure --prefix=/home/xiongli/ --enable-static=yes GLIB_CFLAGS=-I/home/xiongli/include/glib-2.0/ GLIB_LIBS=-L/home/xiongli/lib/ LIBS='-lglib-2.0 -lgio-2.0'

# make

make[2]: Entering directory `/home/xiongli/libnice-0.1.13/gst'
  CC       libgstnice010_la-gstnicesrc.lo
  CC       libgstnice010_la-gstnicesink.lo
In file included from gstnicesink.c:42:
gstnicesink.h:68: error: field 'writable_cond' has incomplete type
gstnicesink.c: In function 'gst_nice_sink_init':
gstnicesink.c:192: warning: implicit declaration of function 'g_cond_init'
gstnicesink.c:192: warning: nested extern declaration of 'g_cond_init'
gstnicesink.c: In function 'gst_nice_sink_dispose':
gstnicesink.c:435: warning: implicit declaration of function 'g_cond_clear'
gstnicesink.c:435: warning: nested extern declaration of 'g_cond_clear'
make[2]: *** [libgstnice010_la-gstnicesink.lo] 错误 1
make[2]: Leaving directory `/home/xiongli/libnice-0.1.13/gst'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/xiongli/libnice-0.1.13'
make: *** [all] 错误 2

发现是因为系统原有的glib造成的影响

# mv /usr/include/glib-2.0/ /usr/include/glib-2.0_bak  //重命名

# ln -s /home/xiongli/include/glib-2.0/ /usr/include/glib-2.0 //链接到新安装的glib头文件路径

 

接下来再次编译LIBNICE,成功后: 

 *   Run two clients, one controlling and one controlled:
 *   simple-example 0 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')
 *   simple-example 1 $(host -4 -t A stun.stunprotocol.org | awk '{ print $4 }')

# cd examples

# ./simple-example 0 stunserver.org

Copy this line to remote client:

  F99F +54hJYc7m6BklqIlPVt2pr 1,2013266431,fe80::5604:a6ff:fe60:1798,57851,host 2,1019216383,fe80::5604:a6ff:fe60:1798,0,host 3,1015022079,fe80::5604:a6ff:fe60:1798,55547,host 4,2013266431,192.168.1.6,49591,host 5,1019216383,192.168.1.6,0,host 6,1015022079,192.168.1.6,56522,host

Enter remote data (single line, no wrapping):
> Suhc 03ladV82UrEvNLmVo9vTGp 1,2013266431,fe80::5604:a6ff:fe60:1798,50104,host 2,1019216383,fe80::5604:a6ff:fe60:1798,0,host 3,1015022079,fe80::5604:a6ff:fe60:1798,60406,host 4,2013266431,192.168.1.6,39574,host 5,1019216383,192.168.1.6,0,host 6,1015022079,192.168.1.6,50853,host

Negotiation complete: ([fe80::5604:a6ff:fe60:1798]:57851, [fe80::5604:a6ff:fe60:1798]:50104)

Send lines to remote (Ctrl-D to quit):
> hello


 打开另一终端:

# cd examples

# ./simple-example 1 stunserver.org

Copy this line to remote client:

  Suhc 03ladV82UrEvNLmVo9vTGp 1,2013266431,fe80::5604:a6ff:fe60:1798,50104,host 2,1019216383,fe80::5604:a6ff:fe60:1798,0,host 3,1015022079,fe80::5604:a6ff:fe60:1798,60406,host 4,2013266431,192.168.1.6,39574,host 5,1019216383,192.168.1.6,0,host 6,1015022079,192.168.1.6,50853,host

Enter remote data (single line, no wrapping):
F99F +54hJYc7m6BklqIlPVt2pr 1,2013266431,fe80::5604:a6ff:fe60:1798,57851,host 2,1019216383,fe80::5604:a6ff:fe60:1798,0,host 3,1015022079,fe80::5604:a6ff:fe60:1798,55547,host 4,2013266431,192.168.1.6,49591,host 5,1019216383,192.168.1.6,0,host 6,1015022079,192.168.1.6,56522,host

Negotiation complete: ([192.168.1.6]:39574, [192.168.1.6]:49591)

Send lines to remote (Ctrl-D to quit):
>
Negotiation complete: ([192.168.1.6]:39574, [192.168.1.6]:49591)

Send lines to remote (Ctrl-D to quit):
> hello

0 0
原创粉丝点击