The short: Linking to libspeex.a when generating a .so using libtool results in a non-portability warning. This is due to PIC code and non-PIC code intermingling.<br>How can I go about fixing this whilst still using an installed libspeex present on the user's system?
<br><br><br>The long:<br>I am using autoconf + libtool to generate a codec plugin for speex (sipXmediaLib), and I'm trying to eliminate the libspeex.so shared library dependency -- I'd like to have it all in one package - so all that is needed is to drop a single plugin that is then dlopened by our application to supply support for the speex codec (and other codecs too, but that conversation doesn't belong here).
<br><br>Here's how I link statically to libspeex now in the plugin's <a href="http://Makefile.am">Makefile.am</a> -- which intermingles PIC code (the non-library source in the new shared library) and position dependent code (
libspeex.a):<br><span style="font-family: courier new,monospace;"> codec_speex_la_SOURCES = PlgSpeex.c speex_nb.c speex_uwb.c speex_wb.c<br> codec_speex_la_LIBADD = @SPEEX_ROOT@/libspeex/.libs/libspeex.a<br> codec_speex_la_LDFLAGS = -module -avoid-version
<br></span><br>(which, I just spotted, will not be correct for installed versions of speex -- only ones we build -- since installed versions will not have the .a in a .lib directory -- but in any case, it should illustrate things well enough)
<br><br>This generates the warning from libtool:<br><span style="font-family: courier new,monospace;"> *** Warning: Linking the shared library codec_speex.la against the</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> *** static library ../../../../../sipXmediaLib/contrib/libspeex/libspeex/.libs/libspeex.a is not portable!</span><br><br>It seems this is a problem for a lot of projects..
<br>Is there a way to do this portably?<br>Is there a good reason that speex (and many other projects) build static libraries with position dependent code and not PIC? (Given that I have never seen this done, I'm guessing there must be a good reason)
<br><br>-- <br>Keith Kyzivat<br><br>SIPez LLC.<br>SIP VoIP, IM and Presence Consulting<br><a href="http://www.SIPez.com">http://www.SIPez.com</a><br>tel: +1 (617) 273-4000