本文介绍了为Python设置pjsip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装pjsip的Python绑定,但是遇到了一个编译错误,我认为这是环境问题,但无法找出问题所在.

I'm trying to install pjsip's Python binding but am running into a build error that I feel is environmental but am just not able to figure out what's wrong.

我能够毫无问题地构建pjsip,但是在尝试构建python绑定时遇到了一个问题-我从ld得到一个错误,原因是其中一个静态库的值错误.

I'm able to build pjsip without issue but run into a problem when trying to build the python bindings -- I'm getting an error from ld about a bad value in one of the static libraries.

有什么想法吗?

root@0fcbc7b108af:/src/pjproject-2.5.5/pjsip-apps/src/python# python setup.py install
running install
running build
running build_py
running build_ext
building '_pjsua' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPJ_AUTOCONF=1 -I/src/pjproject-2.5.5/pjlib/include -I/src/pjproject-2.5.5/pjlib-util/include -I/src/pjproject-2.5.5/pjnath/include -I/src/pjproject-2.5.5/pjmedia/include -I/src/pjproject-2.5.5/pjsip/include -I/usr/include/python2.7 -c _pjsua.c -o build/temp.linux-x86_64-2.7/_pjsua.o
_pjsua.c: In function 'py_pjsua_enum_transports':
_pjsua.c:1202:17: warning: variable 'status' set but not used [-Wunused-but-set-variable]
     pj_status_t status;
             ^
_pjsua.c: In function 'py_pjsua_conf_get_port_info':
_pjsua.c:2338:9: warning: variable 'status' set but not used [-Wunused-but-set-variable]
 int status;
         ^
_pjsua.c: In function 'py_pjsua_get_snd_dev':
_pjsua.c:2714:9: warning: variable 'status' set but not used [-Wunused-but-set-variable]
 int status;
     ^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/_pjsua.o -L/src/pjproject-2.5.5/pjlib/lib -L/src/pjproject-2.5.5/pjlib-util/lib -L/src/pjproject-2.5.5/pjnath/lib -L/src/pjproject-2.5.5/pjmedia/lib -L/src/pjproject-2.5.5/pjsip/lib -L/src/pjproject-2.5.5/third_party/lib -lpjsua-x86_64-unknown-linux-gnu -lpjsip-ua-x86_64-unknown-linux-gnu -lpjsip-simple-x86_64-unknown-linux-gnu -lpjsip-x86_64-unknown-linux-gnu -lpjmedia-codec-x86_64-unknown-linux-gnu -lpjmedia-x86_64-unknown-linux-gnu -lpjmedia-videodev-x86_64-unknown-linux-gnu -lpjmedia-audiodev-x86_64-unknown-linux-gnu -lpjmedia-x86_64-unknown-linux-gnu -lpjnath-x86_64-unknown-linux-gnu -lpjlib-util-x86_64-unknown-linux-gnu -lsrtp-x86_64-unknown-linux-gnu -lresample-x86_64-unknown-linux-gnu -lgsmcodec-x86_64-unknown-linux-gnu -lspeex-x86_64-unknown-linux-gnu -lilbccodec-x86_64-unknown-linux-gnu -lg7221codec-x86_64-unknown-linux-gnu -lyuv-x86_64-unknown-linux-gnu -lpj-x86_64-unknown-linux-gnu -lm -lrt -lpthread -lasound -o build/lib.linux-x86_64-2.7/_pjsua.so
/usr/bin/ld: /src/pjproject-2.5.5/pjsip/lib/libpjsua-x86_64-unknown-linux-gnu.a(pjsua_acc.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/src/pjproject-2.5.5/pjsip/lib/libpjsua-x86_64-unknown-linux-gnu.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

推荐答案

我能够在旧的邮件列表条目中找到答案( http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-August/004456.html ).

I was able to find an answer in an old mailing list entry (http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-August/004456.html).

设置CFLAGS = -fPIC并重建PJSIP库(make clean& ./configure&& make dep& make),然后按照说明制作Python库.

Set CFLAGS=-fPIC and rebuild the PJSIP library (make clean && ./configure && make dep && make), then follow the directions for making the Python library.

这篇关于为Python设置pjsip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 17:25