This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with LD_LIBRARY_PATH and gdb 4.18



I'm using gdb 4.18 (although 4.16 exhibits the same problem) on a Linux x86
machine with glibc 2.1.1 (Red Hat 6.0). gdb fails to run any binaries which
require shared libraries not on the usual search path for ld.so, i.e. any
libraries located by LD_LIBRARY_PATH.

Setting LD_LIBRARY_PATH or gdb 'set solib-search-path' has no effect. Here
is what I see:

> enclave1:~/src/ninja/test/mdw% echo $LD_LIBRARY_PATH
> /home/cs/mdw/lib:/usr/local/ninja/gcc-2.95.1/lib
> enclave1:~/src/ninja/test/mdw% gdb TestT
> GNU gdb 4.18
> Copyright 1998 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i386-redhat-linux"...
> (gdb) run   
> Starting program: /disks/now/grad/mdw/src/ninja/test/mdw/TestT 
> /disks/now/grad/mdw/src/ninja/test/mdw/TestT: error in loading shared libraries: libgcj.so.0: cannot open shared object file: No such file or directory
>
> Program exited with code 0177.

In this case, libgcj.so.0 is found in the LD_LIBRARY_PATH. I can run the
program just fine directly from the shell, but not from within gdb.

I can 'attach' to the running process from gdb, however, in some cases I 
wish to test the code as it's starting, so this is not good enough.

If I set LD_LIBRARY_PATH and run 'strace TestT' from within gdb, it's
obvious that ld.so is not looking for the library in any directories on the
LD_LIBRARY_PATH. Is it possible that gdb is not passing along the value of
this environment variable?

Thanks much,
Matt Welsh, mdw@cs.berkeley.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]