Problems when building against external libltdl, and workarounds

Chí-Thanh Christopher Nguyễn <chithanh-CFLBMwTPW48UNGrzBIF7/[email protected]> Sat, 19 Jun 2010 18:06:57 +0200
Newsgroups gmane.network.siproxd
Message-ID <[email protected]>
Hello,

when building against external libltdl/libtool-2.2, several issues come up.
Doing ./configure && make with libltdl on the system results in:
---
make  all-recursive
make[1]: Entering directory `/tmp/siproxd-0.8.0'
Making all in libltdl
make[2]: Entering directory `/tmp/siproxd-0.8.0/libltdl'
make[2]: *** No rule to make target `all'.  Stop.
make[2]: Leaving directory `/tmp/siproxd-0.8.0/libltdl'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/siproxd-0.8.0'
make: *** [all] Error 2
---
Removing libltdl from SUBDIRS in Makefile.in will make it build, but 
crash on start:
---
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaabbe9ac0 in strcmp () from /lib/libc.so.6
(gdb) bt
#0 0x00002aaaabbe9ac0 in strcmp () from /lib/libc.so.6
#1 0x00002aaaab5459f0 in lt_dlpreload_open () from /usr/lib/libltdl.so.7
#2 0x0000000000416ab3 in load_plugins () at plugins.c:66
#3 0x0000000000406c78 in main (argc=5, argv=0x7fffffffe4b8) at siproxd.c:294
---
Changing src/plugins.h from #include "../libltdl/ltdl.h" to #include 
<ltdl.h> will lead to a new build error:
---
x86_64-pc-linux-gnu-gcc -Wall -D_GNU_SOURCE -DBUILDSTR=\"5471\" -O2 
-pipe -march=amdfam10 -pthread -D_POSIX_THREAD_SAFE_FUNCTIONS -o siproxd 
siproxd.o proxy.o register.o sock.o utils.o sip_utils.o sip_layer.o 
log.o readconf.o rtpproxy.o rtpproxy_relay.o accessctl.o 
route_processing.o security.o auth.o fwapi.o resolve.o dejitter.o 
plugins.o .libs/siproxdS.o -Wl,--export-dynamic  -lresolv 
/usr/lib64/libosip2.so -lnsl /usr/lib64/libosipparser2.so 
/usr/lib64/libltdl.so -ldl
plugins.o: In function `load_plugins':
plugins.c:(.text+0x283): undefined reference to 
`lt__PROGRAM__LTX_preloaded_symbols'
collect2: ld returned 1 exit status
---
And adding a
#define lt__PROGRAM__LTX_preloaded_symbols lt_libltdl_LTX_preloaded_symbols
will finally make it build successfully and not crash on start.


Best regards,
Chi-Thanh Christopher Nguyen

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo