From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31323 invoked by alias); 24 Feb 2013 21:49:35 -0000 Received: (qmail 31303 invoked by uid 48); 24 Feb 2013 21:49:33 -0000 From: "lvernschrock at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug cli/15190] New: programs run inside gdb ignore LD_LIBRARY_PATH Date: Sun, 24 Feb 2013 21:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: cli X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lvernschrock at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2013-q1/txt/msg00317.txt.bz2 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 > > 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 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: ... 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.