<p>好吧,我在网上找不到一个很好的指南,而且@jcm的建议对我很有帮助,所以我想我可以把这个贴在这里。</p>
<p>我有一个类似于操作的问题。在我的构建过程中,我会得到一个错误:</p>
<pre><code>/usr/bin/ld: /opt/pjproject-2.2.1/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
/opt/pjproject-2.2.1/pjsip/lib/libpjsua-x86_64-unknown-linux-gnu.a: could not read symbols: Bad value
</code></pre>
<p>仅仅加上旗子并不能解决问题。</p>
<p>我不知道这有多少是不必要的,但这对我是有用的。请注意,您必须删除文件夹并从头开始。这是可能的“清理”工作,但删除和重建对我来说是最容易的:</p>
<pre><code>sudo apt-get install build-essential python-dev
sudo rm -fr pjproject-2.2.1
tar -xf pjproject-2.2.1.tar.bz2 && cd pjproject-2.2.1/
export CFLAGS="$CFLAGS -fPIC"
./configure && make dep && make
cd pjsip-apps/src/python/
sudo python setup.py install
</code></pre>
<hr/>
<p>我还应该注意到,我在一个虚拟机(ubuntu 14.04)中这样做是因为(据我所知)ubuntu 12.04的编译器有一个导致它segfault的错误:</p>
<pre><code>$ sudo python setup.py install
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying pjsua.py -> build/lib.linux-x86_64-2.7
running build_ext
building '_pjsua' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPJ_AUTOCONF=1 -I/home/isaac_witmer/Downloads/pjproject-2.2.1/pjlib/include -I/home/isaac_witmer/Downloads/pjproject-2.2.1/pjlib-util/include -I/home/isaac_witmer/Downloads/pjproject-2.2.1/pjnath/include -I/home/isaac_witmer/Downloads/pjproject-2.2.1/pjmedia/include -I/home/isaac_witmer/Downloads/pjproject-2.2.1/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]
_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]
_pjsua.c: In function ‘py_pjsua_get_snd_dev’:
_pjsua.c:2714:9: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
In file included from _pjsua.c:20:0:
_pjsua.h: In function ‘PyObj_pjsip_cred_info_delete’:
_pjsua.h:71:13: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccDoI9J3.out file, please attach this to your bugreport.
error: command 'gcc' failed with exit status 1
</code></pre>