Hallvard B Furuseth wrote:
Michael Ströder writes:
So this works great for you. But this won't work for others. And I'd really like to know what's wrong with my suggestion to generally set LD_LIBRARY_PATH in tests/scripts/defines.sh like this:
Setting LD_LIBRARY_PATH in defines.sh was always lame at best. In particular, it does nothing for systems like HPUX or AIX (which use SHLIB_PATH and LIBPATH, respectively) and I imagine there are many other systems in the same boat. Part of the point in using libtool is to avoid having to muck with this kind of stuff directly in our own scripts.
Does that help? man ld.so on RHEL 5.3 says $LD_LIBRARY_PATH is used _after_ an Elf binary's DT_RPATH attribute, unless the DT_RUNPATH attribute is also set. ld does not set DT_RUNPATH by default.
But libtool does by default - look at the DYNAMIC section of lt-slapd:
mandolin:~/OD/hobj/servers/slapd/.libs> readelf -d lt-slapd
Dynamic section at offset 0x125d80 contains 33 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libldap_r-2-devel.so.0] 0x0000000000000001 (NEEDED) Shared library: [liblber-2-devel.so.0] 0x0000000000000001 (NEEDED) Shared library: [libdb-4.7.so] 0x0000000000000001 (NEEDED) Shared library: [libsasl2.so.2] 0x0000000000000001 (NEEDED) Shared library: [libgssapi.so.2] 0x0000000000000001 (NEEDED) Shared library: [libssl.so.0.9.8] 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.0.9.8] 0x0000000000000001 (NEEDED) Shared library: [libresolv.so.2] 0x0000000000000001 (NEEDED) Shared library: [libltdl.so.3] 0x0000000000000001 (NEEDED) Shared library: [libdl.so.2] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000f (RPATH) Library rpath: [/home/hyc/OD/hobj/libraries/libldap_r/.libs:/home/hyc/OD/hobj/libraries/liblber/.libs] 0x000000000000001d (RUNPATH) Library runpath: [/home/hyc/OD/hobj/libraries/libldap_r/.libs:/home/hyc/OD/hobj/libraries/liblber/.libs] 0x000000000000000c (INIT) 0x4159d0 0x000000000000000d (FINI) 0x4c5694 0x0000000000000004 (HASH) 0x4002c8 0x0000000000000005 (STRTAB) 0x40c0b8 0x0000000000000006 (SYMTAB) 0x402bc0 0x000000000000000a (STRSZ) 26669 (bytes) 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000003 (PLTGOT) 0x725fe8 0x0000000000000002 (PLTRELSZ) 8856 (bytes) 0x0000000000000014 (PLTREL) RELA 0x0000000000000017 (JMPREL) 0x413738 0x0000000000000007 (RELA) 0x4135d0 0x0000000000000008 (RELASZ) 360 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x000000006ffffffe (VERNEED) 0x413550 0x000000006fffffff (VERNEEDNUM) 2 0x000000006ffffff0 (VERSYM) 0x4128e6 0x0000000000000000 (NULL) 0x0
That's on a build with no special linker flags configured.
With all default settings, I've never run into any library mismatch problems. We already know about Hallvard's setup; I don't believe there's anything we can or should do to accommodate nonstandard linker settings. When you change the linker flags, you should know what you're doing.