Subject: how are libraries found on ELF systems
To: None <>
From: mocha <>
List: current-users
Date: 05/22/2000 00:38:20
netbsd 1.4y/alpha -current

I'm just curious how NetBSD libraries (loadable) are found by their apps. 
Is LD_LIBRARY_PATH used at all? how about /etc/ld.conf?

the reason i ask is because of my recent trouble with compiling php4 and 
mod-ssl on this machine. i noticed that if i explicity define the -rpath 
during the link phase, then everything is fine. however, when i just 'make' 
the apps, and it does it's own thing, the library paths aren't found. so 
the apps core dumps. i've tested this and it's repeatable. Even setting 
LD_LIBRARY_PATH with the right paths didn't help. the apps still core dump 
when it couldn't find the libs.

i've confirmed this by compiling php4 with gdbm, mysql:
1. compile using 'make'
3. ldd shows mising library paths
4. export LD_LIBRARY_PATH=/path/to/libs
5. start apache with php4 module activated.
6. core dumps. gdb bt shows it was trying to load a library.

another scenario:
1. compile with 'make'
2. when it ends, redo the link (ld) process with explicit --rpath /path/to/libs
4. ldd shows all libraries and paths are there
5. copy the new php module to apache module lib dir
5. start apache, works.

yes php4 does use kinda buggy libtool and it's not passing the right 
--rpath to ld. but shouldn't defining LD_LIBRARY_PATH take care of that 
during run time?

this also happens when i was trying to compile modssl for apache. though 
modssl doesn't use libtool, the --rpath aren't still being passed to ld.

you can try this by installing apache, then ap-ssl, or (i think) ap-php 
too. it will core dump. and if you do ldd on the modules, you'll find that 
it's missing the --rpath's to the libraries (unset LD_LIBRARY_PATH first). 
then set LD_LIBRARY_PATH and start apache, it will core dump. make sure you 
test this on -current.