LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2009, 10:39 AM   #1
mihk
LQ Newbie
 
Registered: Oct 2005
Distribution: debian
Posts: 17

Rep: Reputation: 0
gdb says "cannot open shared object file"


Hello all,
I have one binary and one shared library.
The shared library is compiled with:

all:
g++ -g -shared -fpic $(SOURCES) -o libmisc.so

the binary is compiled with:

LIBS=-L../../misc/src
LDFLAGS=-lmisc

all:
g++ -g -o mainx $(INCLUDE) $(SOURCE) $(LIBS) $(LDFLAGS)


I set in ~/.bashrc
export LD_LIBRARY_PATH=/mnt/sda5/Programming/misc/src/
to the libmisc.so output path.

Debugging from console works fine:
gdb mainx

However from Emacs22, launching gdb fails with the following message:

"Starting program: /mnt/sda5/Programming/main/src/mainx
/mnt/sda5/Programming/main/src/mainx: error while loading shared libraries: libmisc.so: cannot open shared object file: No such file or directory"

This looks very tricky for the moment, and I couldn't solve it. I am not sure if this a emacs's problem, or I should pass a parameter in gdb's command line. Please share your ideas with me.
mihk
 
Old 05-31-2009, 01:10 PM   #2
mihk
LQ Newbie
 
Registered: Oct 2005
Distribution: debian
Posts: 17

Original Poster
Rep: Reputation: 0
I solved my problem.
I will post here for anybody who will search for it.

Emacs din not read my .bashrc before it invoked gdb. I tried 'set solib-search-path' and 'set solib-absolute-path' in my .gdbinit file and it worked very well.

set solib-search-path /mnt/sda5/Programming/misc/src
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: "libdmx.so.1: cannot open shared object file: No such file or directory" ESC201 Linux - Software 4 11-01-2008 08:38 PM
gdb error "Failed to read a valid object file image from memory." Fejimush Programming 0 03-11-2007 01:40 PM
Tip: handling "cannot open shared object file..." sundialsvcs Linux - Newbie 1 03-06-2006 12:57 PM
"libXm.so.3: cannot open shared object" cbranje Programming 5 02-01-2005 07:27 AM
Not loading gdm;"libX11.so.6 cannot open shared object" zlobby Linux - Newbie 6 03-03-2004 04:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration