public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH
@ 2013-02-24 21:49 lvernschrock at gmail dot com
  2013-02-26 15:39 ` [Bug cli/15190] " jan.kratochvil at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: lvernschrock at gmail dot com @ 2013-02-24 21:49 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug cli/15190] programs run inside gdb ignore LD_LIBRARY_PATH
  2013-02-24 21:49 [Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH lvernschrock at gmail dot com
@ 2013-02-26 15:39 ` jan.kratochvil at redhat dot com
  2013-02-26 20:18 ` palves at redhat dot com
  2013-02-27 15:01 ` lvernschrock at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-02-26 15:39 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15190

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |jan.kratochvil at redhat
                   |                            |dot com

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2013-02-26 15:39:10 UTC ---
Not reproducible for me (Fedora 17 x86_64):

$ echo $LD_LIBRARY_PATH
/home/jkratoch/t/mylib
$ /tmp/gdb-7.2/gdb/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 "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/jkratoch/t/demo...(no debugging symbols
found)...done.
(gdb) show env LD_LIBRARY_PATH
LD_LIBRARY_PATH = /home/jkratoch/t/mylib
(gdb) run
Starting program: /home/jkratoch/t/demo 
your computer is awsome

Program exited normally.
(gdb) q

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug cli/15190] programs run inside gdb ignore LD_LIBRARY_PATH
  2013-02-24 21:49 [Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH lvernschrock at gmail dot com
  2013-02-26 15:39 ` [Bug cli/15190] " jan.kratochvil at redhat dot com
@ 2013-02-26 20:18 ` palves at redhat dot com
  2013-02-27 15:01 ` lvernschrock at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: palves at redhat dot com @ 2013-02-26 20:18 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15190

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #2 from Pedro Alves <palves at redhat dot com> 2013-02-26 20:18:22 UTC ---
Could it be something in your shell's config clearing the environment?

GDB runs the program like "exec $SHELL -c program".

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug cli/15190] programs run inside gdb ignore LD_LIBRARY_PATH
  2013-02-24 21:49 [Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH lvernschrock at gmail dot com
  2013-02-26 15:39 ` [Bug cli/15190] " jan.kratochvil at redhat dot com
  2013-02-26 20:18 ` palves at redhat dot com
@ 2013-02-27 15:01 ` lvernschrock at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: lvernschrock at gmail dot com @ 2013-02-27 15:01 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15190

lvernschrock at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #3 from lvernschrock at gmail dot com 2013-02-27 15:01:26 UTC ---
Okay, it is defiantly a problem with my shell configuration.

[quote]
tc@box:~$ export LD_LIBRARY_PATH=/home/tc/mylib
tc@box:~$ echo $LD_LIBRARY_PATH
/home/tc/mylib
tc@box:~$ $SHELL
tc@box:~$  echo $LD_LIBRARY_PATH

tc@box:~$ exit
tc@box:~$  echo $LD_LIBRARY_PATH
/home/tc/mylib
[/quote]

Thus I assume that this is an invalid bug. I'll mark it as a duplicate of bug#
9011.

*** This bug has been marked as a duplicate of bug 9011 ***

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-27 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-24 21:49 [Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH lvernschrock at gmail dot com
2013-02-26 15:39 ` [Bug cli/15190] " jan.kratochvil at redhat dot com
2013-02-26 20:18 ` palves at redhat dot com
2013-02-27 15:01 ` lvernschrock at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).