lvernschrock at gmail dot com
2013-02-24 21:49:33 UTC
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: ***@sourceware.org
ReportedBy: ***@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]
***@box:~$ gcc demo.o -Lmylib -lawsome -o demo
***@box:~$ ./demo
./demo: error while loading shared libraries: libawsome.so: cannot open shared
object file: No such file or directory
***@box:~$ export LD_LIBRARY_PATH=~/mylib
***@box:~$ ./demo
your computer is awsome
***@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.
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: ***@sourceware.org
ReportedBy: ***@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]
void printmessage();
EOF
#include "awsome.h"
#include <stdio.h>
void printmessage(){
printf("your computer is awsome\n");
}
EOF
#include "awsome.h"
int main(int argv){
printmessage();
return 0;
}
EOF
***@box:~$ gcc -c demo.c -o demo.oEOF
#include "awsome.h"
#include <stdio.h>
void printmessage(){
printf("your computer is awsome\n");
}
EOF
#include "awsome.h"
int main(int argv){
printmessage();
return 0;
}
EOF
***@box:~$ gcc demo.o -Lmylib -lawsome -o demo
***@box:~$ ./demo
./demo: error while loading shared libraries: libawsome.so: cannot open shared
object file: No such file or directory
***@box:~$ export LD_LIBRARY_PATH=~/mylib
***@box:~$ ./demo
your computer is awsome
***@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.
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.