Ubuntu下编译Libjingle


$ gclient config http://libjingle.googlecode.com/svn/trunk    生成.gclient文件
$ gclient sync                获取源代码

$ gclient runhooks         生成Makefile文件


执行runhooks 这步会出现如下几个错误 :


Updating projects from gyp files...
Package nss was not found in the pkg-config search path.
Perhaps you should add the directory containing `nss.pc'
to the PKG_CONFIG_PATH environment variable
No package 'nss' found

安装这个包即可 :apt-get install libnss3-dev

Updating projects from gyp files...
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found

安装这个包即可 :apt-get install libgtk2.0-dev


下来 cd  trunk 目录, 已经有Makefile 文件了,

直接Make, 出错如下:


  CXX(target) out/Debug/obj.target/libjingle/talk/base/helpers.o
talk/base/helpers.cc:34:26: 致命错误: openssl/rand.h:没有那个文件或目录
编译中断。
make: *** [out/Debug/obj.target/libjingle/talk/base/helpers.o] 错误 1


下载

openssl-1.0.1e.tar.gz 安装

 ./config --prefix=/usr --openssldir=/usr/openssl

make
make test
make install

安装好了 openssl, 在进入到 Libjingle 的trunk目录, 继续make


编译成功了, 但是链接出错 :

out/Debug/../../third_party/gold/gold32: /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib/libssl.a(t1_enc.o): in function tls1_change_cipher_state:t1_enc.c(.text+0x7d0): error: undefined reference to 'COMP_CTX_free'
out/Debug/../../third_party/gold/gold32: /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib/libssl.a(t1_enc.o): in function tls1_change_cipher_state:t1_enc.c(.text+0x7ed): error: undefined reference to 'COMP_CTX_new'
out/Debug/../../third_party/gold/gold32: /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib/libssl.a(t1_enc.o): in function tls1_change_cipher_state:t1_enc.c(.text+0x8aa): error: undefined reference to 'COMP_CTX_free'
out/Debug/../../third_party/gold/gold32: /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../../lib/libssl.a(t1_enc.o): in function tls1_change_cipher_state:t1_enc.c(.text+0x8c3): error: undefined reference to 'COMP_CTX_new'


出现上面的错误的原因是库的链接顺序不对造成的,如果为 -lcrypto -lssl就会编译错误。需要修改为 -lssl  -lcrypto , 从编译的项目里面找到 mk 文件, 搜索-lssl, 把它放到 -lcrypto的前面即可。


你可能感兴趣的:(Ubuntu下编译Libjingle)