ldd is not honoring LD_LIBRARY_PATH
Carmelo AMOROSO
carmelo.amoroso at st.com
Fri Oct 7 13:26:49 UTC 2011
Hi,
using the ldd implementation based on ld.so tracing by the environment
variable LD_TRACE_LOADED_OBJECTS, LD_LIBRARY_PATH is not taken into
account. So it could not found some libraries installed into a non
standard path.
This is why the environment passed to the program is hard-coded
static const char *const environment[] = {
"PATH=/usr/bin:/bin:/usr/sbin:/sbin",
"SHELL=/bin/sh",
"LD_TRACE_LOADED_OBJECTS=1",
NULL
};
if ((pid = vfork()) == 0) {
/* Cool, it looks like we should be able to actually
* run this puppy. Do so now... */
execle(filename, filename, NULL, environment);
_exit(0xdead);
}
I'll send a patch shortly for review.
Further I'm wondering why do we need to implement ldd in C code.
I've seen that in glibc it's just a shell script to invoke the ld.so in
stand-alone mode with tracing (it inherits the environment so indeed
LD_LIBRARY_PATH is honored)
The simplest implementation of ldd could be
LD_TRACE_LOADED_OBJECTS=1 $1
Cheers,
Carmelo
More information about the uClibc
mailing list