This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH
- From: "lvernschrock at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sun, 24 Feb 2013 21:49:33 +0000
- Subject: [Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=15190
Bug #: 15190
Summary: programs run inside gdb ignore LD_LIBRARY_PATH
Product: gdb
Version: 7.2
Status: NEW
Severity: normal
Priority: P2
Component: cli
AssignedTo: unassigned@sourceware.org
ReportedBy: lvernschrock@gmail.com
Classification: Unclassified
This looks very similar to bug # 9011. I think that the easiest way to discuss
this is to simply paste my shell output in the bug report:
[quote]
tc@box:~$ cat > awsome.h << EOF
> void printmessage();
> EOF
tc@box:~$ cat > awsome.c << EOF
> #include "awsome.h"
> #include <stdio.h>
>
> void printmessage(){
> printf("your computer is awsome\n");
> }
> EOF
tc@box:~$ mkdir mylib
tc@box:~$ gcc -fPIC -c awsome.c -o awsome.o
tc@box:~$ gcc -shared awsome.o -o mylib/libawsome.so
tc@box:~$ cat > demo.c << EOF
> #include "awsome.h"
>
> int main(int argv){
> printmessage();
> return 0;
> }
> EOF
tc@box:~$ gcc -c demo.c -o demo.o
tc@box:~$ gcc demo.o -Lmylib -lawsome -o demo
tc@box:~$ ./demo
./demo: error while loading shared libraries: libawsome.so: cannot open shared
object file: No such file or directory
tc@box:~$ export LD_LIBRARY_PATH=~/mylib
tc@box:~$ ./demo
your computer is awsome
tc@box:~$ gdb demo
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/tc/demo...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/tc/demo
/home/tc/demo: error while loading shared libraries: libawsome.so: cannot open
shared object file: No such file or directory
Program exited with code 0177.
(gdb) show env LD_LIBRARY_PATH
LD_LIBRARY_PATH = /home/tc/mylib
(gdb) quit
[/quote]
What really bothers me is the output from "show env LD_LIBRARY_PATH".
It seems that gdb sees the environmental variable; why can't the program inside
see it?
I'm running on a Linux-based O.S.; kernel version 3.0.21.
P.S. I don't actually want to debug this demo program. I'm trying to debug a
more complex program and I wrote this trivial example to illustrate the issue
I'm running into.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.