[asterisk-dev] pjproject: separate libraries

Jason Parker jparker at digium.com
Wed May 1 14:40:06 CDT 2013


On 04/21/2013 07:18 AM, Tzafrir Cohen wrote:
> Hi all,
>
> Is this the right place for dynaminc pjproject packaging dilemmas?
>
> I built Asterisk with the dynamic library pjproject.
>
> Now I have:
>
> $ ldd res/res_rtp_asterisk.so
>          linux-vdso.so.1 =>  (0x00007fced667c000)
>          libpjsua.so.2 => /usr/lib/libpjsua.so.2 (0x00007fced6189000)
>          libpjsip-ua.so.2 => /usr/lib/libpjsip-ua.so.2 (0x00007fced5f70000)
>          libpjsip-simple.so.2 => /usr/lib/libpjsip-simple.so.2 (0x00007fced5d5a000)
>          libpjsip.so.2 => /usr/lib/libpjsip.so.2 (0x00007fced5b0d000)
>          libpjmedia-codec.so.2 => /usr/lib/libpjmedia-codec.so.2 (0x00007fced5901000)
>          libpjmedia.so.2 => /usr/lib/libpjmedia.so.2 (0x00007fced56ac000)
>          libpjmedia-videodev.so.2 => /usr/lib/libpjmedia-videodev.so.2 (0x00007fced54aa000)
>          libpjmedia-audiodev.so.2 => /usr/lib/libpjmedia-audiodev.so.2 (0x00007fced52a1000)
>          libpjnath.so.2 => /usr/lib/libpjnath.so.2 (0x00007fced5078000)
>          libpjlib-util.so.2 => /usr/lib/libpjlib-util.so.2 (0x00007fced4e5b000)
>          libsrtp.so.0 => /usr/lib/libsrtp.so.0 (0x00007fced4c3d000)
>          libgsm.so.1 => /usr/lib/x86_64-linux-gnu/libgsm.so.1 (0x00007fced4a2f000)
>          libspeex.so.1 => /usr/lib/x86_64-linux-gnu/libspeex.so.1 (0x00007fced4817000)
>          libspeexdsp.so.1 => /usr/lib/x86_64-linux-gnu/libspeexdsp.so.1 (0x00007fced4605000)
>          libportaudio.so.2 => /usr/lib/x86_64-linux-gnu/libportaudio.so.2 (0x00007fced43d5000)
>          libpj.so.2 => /usr/lib/libpj.so.2 (0x00007fced41a9000)
>          libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fced3fa4000)
>          libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fced3d21000)
>          libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fced3b09000)
>          librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fced3901000)
>          libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fced36e4000)
>          libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007fced33f0000)
>          libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fced300c000)
>          libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fced2dac000)
>          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fced2a22000)
>          libjack.so.0 => /usr/lib/x86_64-linux-gnu/libjack.so.0 (0x00007fced2803000)
>          /lib64/ld-linux-x86-64.so.2 (0x00007fced667d000)
>          libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fced25fe000)
>          libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fced23e7000)
>
> At first glance I believe that from those 30 lines the ones I actually
> need are:
>
>          linux-vdso.so.1 =>  (0x00007fced667c000)
>          libpjsip.so.2 => /usr/lib/libpjsip.so.2 (0x00007fced5b0d000)
>          libpjnath.so.2 => /usr/lib/libpjnath.so.2 (0x00007fced5078000)
>          libpjlib-util.so.2 => /usr/lib/libpjlib-util.so.2 (0x00007fced4e5b000)
>          libpj.so.2 => /usr/lib/libpj.so.2 (0x00007fced41a9000)
>          libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fced300c000)
>          libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fced2dac000)
>          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fced2a22000)
>          libjack.so.0 => /usr/lib/x86_64-linux-gnu/libjack.so.0 (0x00007fced2803000)
>          /lib64/ld-linux-x86-64.so.2 (0x00007fced667d000)
>          libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fced25fe000)
>          libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fced23e7000)
>
> There are two issues here:
>
> 1. pjproject's build links all the different pj* libraries with a
> certain set of libraries, and thus anything that gets linked with any of
> them gets linked iwth, say, libm, libuuid and whatever.
>
> 2. There is a single libpjproject.pc pkg-config file. Asterisk only
> needs to be lined with pjnath (and what others?) and this would have
> pulled pj, pjlib-utils and one or two more. But as there is a single
> option, all the media libraries are pulled in as well.
>
> Which libraries does Asterisk really need? Which target libraries would
> it make sense to have pkg-config files for?
>

When I was doing this, I started down the road of adding configure 
checks for each library, and requiring that each (Asterisk) module list 
every (pjproject) library it needed as a dependency.  The list got quite 
large.  Currently, the libraries in use in Asterisk trunk are: libpj, 
libpj-util, libpjsip, libpjsip-ua, libpjsip-simple, libpjmedia, and 
libpjnath.  As snuffy's recent patch shows, people have already 
forgotten to add the pjproject and res_sip dependencies to their code.  
I don't think anybody wants to imagine what it'd look like, if we were 
to split it out like that.

I'm not sure that it's particularly useful to think of pjproject as 
anything less than a whole.  We're using little bits and pieces from all 
over, and that usage will only increase.

We could make a pkg-config file for each of pjlib, pjlib-util, pjnath, 
pjmedia, and pjsip, if we really had to, but since it all needs to be 
loaded into memory anyways - what is the benefit?


As for portaudio, gsm, speex, etc, pjproject can disable linking those, 
via its configure script.



More information about the asterisk-dev mailing list