Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

In emacs, gdb says "cannot open shared object file"

133 views
Skip to first unread message

Mihai Vasilian

unread,
May 31, 2009, 12:18:55 PM5/31/09
to help-gn...@gnu.org
Hi all,
I ran into a problem recently with emacs and gdb, and right now I am looking for some help, posting here.
I compiled one program and one shared library in their coresponding $MYPATH/prg/src and $MYPATH/misc/src folders.
I set in ~/.bashrc the variable LD_LIBRARY_PATH to point to $MYPATH/misc/src folder where libmisc.so is saved.
I open console and run:  gdb prg    and everything goes fine.
I started to work with emacs recently and I go with: M-x gdb , gdb prg  , and then break main, and run.
I get the following error message:
Starting program: /mnt/sda5/Programming/prg/src/prg
/mnt/sda5/Programming/prg/src/prg: error while loading shared libraries: libmisc.so: cannot open shared object file: No such file or directory
If this (my fist post) on list is not the appropiate thing to find a solution to my problem, please advice.
vmihai.

Nick Roberts

unread,
Jun 1, 2009, 1:19:22 AM6/1/09
to Mihai Vasilian, help-gn...@gnu.org
> I get the following error message:
> Starting program: /mnt/sda5/Programming/prg/src/prg
> /mnt/sda5/Programming/prg/src/prg: error while loading shared libraries:
> libmisc.so: cannot open shared object file: No such file or directory

It doesn't sound like in Emacs problem. Does

ldd /mnt/sda5/Programming/prg/src/prg

find libmisc.so?

What happens if you run gdb from the command line? If you start Emacs from
the desktop, LD_LIBRARY_PATH might not be set.

$MYPATH/prg/src and $MYPATH/misc/src look like src folders. It's usual to
to put executables and shared objects in bin and lib directories respectively.

--
Nick http://www.inet.net.nz/~nickrob


Mihai Vasilian

unread,
Jun 1, 2009, 5:13:12 AM6/1/09
to Nick Roberts, help-gn...@gnu.org
2009/6/1 Nick Roberts <nic...@snap.net.nz>

With LD_LIBRARY_PATH set in ~/.bashrc   , gdb was loading misc library when started from console.
However when started from emacs , as well as from kdevelop, it was not loading misc

I solved it by adding to my .gdbinit
set solib-search-path /mnt/sda5/Programming/misc/src

It works also if I add to my prg's Makefile
g++ ....  -lmisc -Wl,-rpath=/mnt/sda5/Programming/misc/src

I see now it was a gdb issue, not an emacs or kdevelop one.
Thanks again.

Alberto Luaces

unread,
Jun 2, 2009, 3:14:48 AM6/2/09
to help-gn...@gnu.org
El Lunes 01 Junio 2009ES 11:13:12 Mihai Vasilian escribió:
> I see now it was a gdb issue, not an emacs or kdevelop one.

If you need to set this or some other environment variables, you can also use
the "set environment" command from gdb:

set environment FOO=foo

Regards,

Alberto


0 new messages