Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 05-31-2009, 10:39 AM   #1
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:

g++ -g -shared -fpic $(SOURCES) -o

the binary is compiled with:


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

I set in ~/.bashrc
export LD_LIBRARY_PATH=/mnt/sda5/Programming/misc/src/
to the 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: 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.
Old 05-31-2009, 01:10 PM   #2
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


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: " 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
" cannot open shared object" cbranje Programming 5 02-01-2005 07:27 AM
Not loading gdm;" cannot open shared object" zlobby Linux - Newbie 6 03-03-2004 04:30 PM > Forums > Non-*NIX Forums > Programming

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

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