我有一个二进制和一个共享库。 共享库编译时使用:
all: g ++ -g -shared -fpic $(SOURCES)-o libmisc.so
二进制文件编译时使用:
LIBS = -L ../../ misc / src
LDFLAGS = -lmisc
all: g ++ -g -o mainx $(INCLUDE)$ )$(LIBS)$(LDFLAGS)
我设置在〜/ .bashrc export LD_LIBRARY_PATH = / mnt / sda5 / Programming / misc / src / 到libmisc.so输出路径。
从控制台调试工作正常:
gdb mainx
但是从Emacs22启动gdb失败,并显示以下消息:
启动程序:/ mnt / sda5 /编译/ main / src / mainx / mnt / sda5 / Programming / main / src / mainx:加载共享库时出错:libmisc.so:无法打开共享对象文件:没有这样的文件或目录
这看起来很棘手,我不能解决它。我不知道这是一个emacs的问题,或者我应该在gdb的命令行中传递一个参数。请与我分享您的想法。
vmihai
解决方案Emacs在它调用gdb之前不读取.bashrc。尝试在您的.gdbinit文件中设置set solib-search-path和set solib-absolute-path
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.
vmihai
解决方案Emacs probably does not read your .bashrc before it invokes gdb. Try to put 'set solib-search-path' and 'set solib-absolute-path in your .gdbinit file instead
更多推荐
gdb说“无法打开共享对象文件”
发布评论