[asterisk-dev] pjproject review (code.asterisk.org), support shared libraries.

Walter Doekes walter+asterisk-dev at osso.nl
Wed Feb 27 03:06:39 CST 2013

>> On 13-02-19 02:50 PM, Jason Parker wrote:
>> Review:
>>      https://code.asterisk.org/code/cru/CR-AST-12
>> (For testing purposes, this code currently lives in the patch/shared-libraries
>> branch on git://github.com/asterisk/pjproject.git)
> There is now a branch of Asterisk [1] that this can be used with, if that was a holdup for reviews.  pjproject has been removed from the tree here, and it now depends on shared libraries.
> [1] https://origsvn.digium.com/svn/asterisk/team/qwell/pjsip-shared-libs/

Ok. So I checked it out:

   ~/src/pjproject$ $ git checkout -b shared-libraries \

Ran ./configure. Turned out it built only .a files.

   ~/src/pjproject$ grep shared\ libr config.log
   aconfigure:5423: result: Building shared libraries... no

Ran ./configure --enable-shared (after distclean!). Better. But now make 
fails when linking test.o on missing video functions:

   gcc -o ../bin/pjmedia-test-x86_64-unknown-linux-gnu \
      ... -lpjmedia-codec -lpjmedia-videodev -lpjmedia ...
   .../lib/libpjmedia-videodev.so: undefined reference to

Seemingly I've configured without video: pjmedia_format_init_video and 
friends are not included in libpjmedia-videodev.so:

   ~/src/pjproject$ nm pjmedia/lib/libpjmedia-videodev.so |
     grep format_init
   U pjmedia_format_init_video

Which wouldn't be a problem because I don't think I need 
libpjmedia-videodev.so to be included at all, but libpjmedia.so was 
linked against it. Removing -lpjmedia-videodev makes the linker complain 
that libpjmedia-videodev.so isn't found.

   ~/src/pjproject$ ldd pjmedia/lib/libpjmedia.so | grep video
   libpjmedia-videodev.so => not found

Turns out configure thought v4l2 (videoforlinux) was available while not 

Once more.

   ~/src/pjproject$ make distclean &&
     ./configure --disable-v4l2 --enable-shared && make && make dep

It builds.

And indeed: /asterisk/team/qwell/pjsip-shared-libs res_rtp_asterisk.so 
now builds with PJNATH support. (Compile tested only.)

Nice work!


P.S. I don't like that it doesn't have a make uninstall.

This'll have to do for now:

   ~/src/pjproject$ find . -name '*.so' -or -name '*.a' |
     sed -e 's#.*/##' |
     while read x; do sudo rm -fv /usr/local/lib/$x*; done

   ~/src/pjproject$ sudo rm -vrf /usr/local/include/pj* \

More information about the asterisk-dev mailing list