Re: [pjsip] Error building PJSUA2 python SWIG module

LB
Luke Biddle
Thu, Nov 23, 2017 1:45 AM

If anyone stumbles upon this later, I found the solution. In the steps
below, replace the ./configure command with this:
export CFLAGS="$CFLAGS -fPIC" && ./configure

Perhaps this info should be included in one of the build tutorials.

On 17 November 2017 at 14:29, Luke Biddle lukeandrewbiddle@gmail.com
wrote:

Hi,

I'm trying to build PJSUA2 and accompanying SWIG module for python, but
I'm running into an error that I can't figure out. The compiler is throwing
an error when i attempt to 'make' in pjsip-apps/src/swig. The error is:

g++ -pthread -shared -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
build/temp.linux-x86_64-3.5/pjsua2_wrap.o -L/usr/lib64
-lpjsua2-x86_64-unknown-linux-gnu -lstdc++ -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 -lwebrtc-x86_64-unknown-linux-gnu
-lpj-x86_64-unknown-linux-gnu -lssl -lcrypto -lm -lrt -lpthread -lasound
-lSDL2 -lavdevice -lavformat -lavcodec -lswscale -lavutil -lpython3.5m -o
build/lib.linux-x86_64-3.5/_pjsua2.cpython-35m-x86_64-linux-gnu.so
-L/opt/pjproject/pjlib/lib -L/opt/pjproject/pjlib-util/lib
-L/opt/pjproject/pjnath/lib -L/opt/pjproject/pjmedia/lib
-L/opt/pjproject/pjsip/lib -L/opt/pjproject/third_party/lib -lSDL2
-lavdevice -lavformat -lavcodec -lswscale -lavutil -lSDL2 -lavdevice
-lavformat -lavcodec -lswscale -lavutil
/usr/bin/ld: /opt/pjproject/pjsip/lib/libpjsua2-x86_64-unknown-linux-gnu.a(account.o):
relocation R_X86_64_32S against `_ZTVN2pj7AccountE' can not be used when
making a shared object; recompile with -fPIC
/opt/pjproject/pjsip/lib/libpjsua2-x86_64-unknown-linux-gnu.a: error
adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
Makefile:29: recipe for target '_pjsua2.so' failed
make[1]: *** [_pjsua2.so] Error 1
make[1]: Leaving directory '/opt/pjproject/pjsip-apps/src/swig/python'
Makefile:23: recipe for target 'all' failed
make: *** [all] Error 1

Here's a full list of the commands I did to get here:

- python -m pip install pycparser
- dnf install alsa-lib-devel
- dnf install python-devel
- dnf install gcc-c++
- dnf install cmake
- dnf install svn
- dnf install swig
- dnf install java-1.8.0-openjdk

- cd /opt
- svn co http://svn.pjsip.org/repos/pjproject/trunk pjproject
- cd pjproject
- ./configure
- make dep
- make
- make install
- cd pjsip-apps/src/swig
- make <-- Fails on this one

Here is my env:

- Fedora25
- kernel 4.10.10-200.fc25.x86_64

The error seems to be telling me to recompile with the -fPIC flag, I'm
just not sure what needs that flag or where it should go. Can anyone help
me out?

Regards,

Luke

If anyone stumbles upon this later, I found the solution. In the steps below, replace the ./configure command with this: export CFLAGS="$CFLAGS -fPIC" && ./configure Perhaps this info should be included in one of the build tutorials. On 17 November 2017 at 14:29, Luke Biddle <lukeandrewbiddle@gmail.com> wrote: > Hi, > > I'm trying to build PJSUA2 and accompanying SWIG module for python, but > I'm running into an error that I can't figure out. The compiler is throwing > an error when i attempt to 'make' in pjsip-apps/src/swig. The error is: > > g++ -pthread -shared -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld > build/temp.linux-x86_64-3.5/pjsua2_wrap.o -L/usr/lib64 > -lpjsua2-x86_64-unknown-linux-gnu -lstdc++ -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 -lwebrtc-x86_64-unknown-linux-gnu > -lpj-x86_64-unknown-linux-gnu -lssl -lcrypto -lm -lrt -lpthread -lasound > -lSDL2 -lavdevice -lavformat -lavcodec -lswscale -lavutil -lpython3.5m -o > build/lib.linux-x86_64-3.5/_pjsua2.cpython-35m-x86_64-linux-gnu.so > -L/opt/pjproject/pjlib/lib -L/opt/pjproject/pjlib-util/lib > -L/opt/pjproject/pjnath/lib -L/opt/pjproject/pjmedia/lib > -L/opt/pjproject/pjsip/lib -L/opt/pjproject/third_party/lib -lSDL2 > -lavdevice -lavformat -lavcodec -lswscale -lavutil -lSDL2 -lavdevice > -lavformat -lavcodec -lswscale -lavutil > /usr/bin/ld: /opt/pjproject/pjsip/lib/libpjsua2-x86_64-unknown-linux-gnu.a(account.o): > relocation R_X86_64_32S against `_ZTVN2pj7AccountE' can not be used when > making a shared object; recompile with -fPIC > /opt/pjproject/pjsip/lib/libpjsua2-x86_64-unknown-linux-gnu.a: error > adding symbols: Bad value > collect2: error: ld returned 1 exit status > error: command 'g++' failed with exit status 1 > Makefile:29: recipe for target '_pjsua2.so' failed > make[1]: *** [_pjsua2.so] Error 1 > make[1]: Leaving directory '/opt/pjproject/pjsip-apps/src/swig/python' > Makefile:23: recipe for target 'all' failed > make: *** [all] Error 1 > > Here's a full list of the commands I did to get here: > > - python -m pip install pycparser > - dnf install alsa-lib-devel > - dnf install python-devel > - dnf install gcc-c++ > - dnf install cmake > - dnf install svn > - dnf install swig > - dnf install java-1.8.0-openjdk > > - cd /opt > - svn co http://svn.pjsip.org/repos/pjproject/trunk pjproject > - cd pjproject > - ./configure > - make dep > - make > - make install > - cd pjsip-apps/src/swig > - make <-- Fails on this one > > Here is my env: > > - Fedora25 > - kernel 4.10.10-200.fc25.x86_64 > > The error seems to be telling me to recompile with the -fPIC flag, I'm > just not sure what needs that flag or where it should go. Can anyone help > me out? > > > Regards, > > Luke >