无法使用 python 支持安装 GDB

2022-01-20 00:00:00 python gdb

问题描述

问题是,我想在我的 GDB 安装中支持 python.我跑的时候

The thing is, I want to have python support in my GDB installation. When I ran

./configure --with-python 

make

但是,在 GDB 源文件目录中,make"退出并显示以下信息:

in the GDB source file directory, however, the "make" exited with the following information:

checking whether to use python... yes
checking for python... (cached) /home/tools/tools/../bin/64//python
checking for python2.7... no
configure: error: python is missing or unusable"

请注意,返回的信息可能表明make"程序正在尝试在/home/tools/tools/../bin/64//python"目录中查找python安装,但这不是我的帐户的默认 python 安装.我已经设置了 $PATH 变量以使python"命令指向我自己的 python 安装,它位于主目录下.

Note that the returned information possible indicates that the "make" program is trying to find a python intallation in "/home/tools/tools/../bin/64//python" directory, which, however is not the default python installation of my account. I've set the $PATH variable to make the "python" command pointing to a python installation of my own, which resides under home directory.

这是为什么?任何人都可以帮忙吗?一千多谢.

Why is this? Can anyone help? A thousand thanks.

PS.有一件事我不确定,因为我只想让一些脚本在.gdbinit"文件中自动运行,这看起来像是一些 python 脚本.支持这个脚本就等于让GDB可以调试python脚本吗??

PS. There's one thing I'm not sure, since I only want to have some script automatically run in the ".gdbinit" file, which seems like some python script. Does supporting this script equal to making GDB able to debug python script??


解决方案

我也遇到了同样的问题.我正在使用 Python 2.7.10 - Anaconda 2.3.0(安装在非标准位置)和 GDB-7.11.事实证明,在 gdb-7.11/ 中有多个自动配置.当我检查 gdb-7.11/gdb/config.cache 时,出现错误,因为它找不到 python2.7 库.所以解决方案是export LDFLAGS,在gdb-7.11中运行顶层自动配置,否则gdb-7.11/中的自动配置gdb 将不知道在哪里可以找到 python2.7 库.

I had this same problem. I am using Python 2.7.10 - Anaconda 2.3.0 (installed in a non-standard location), and GDB-7.11. It turns out that within gdb-7.11/ there are multiple autoconfigs. When I inspected gdb-7.11/gdb/config.cache, there was an error because it could not find python2.7 library. So the solution is to export LDFLAGS, when running the top level autoconfig in gdb-7.11 otherwise the autoconfig in gdb-7.11/gdb will not know where to find the python2.7 library.

例如

 make distclean
 cd gdb/
 make distclean
 cd ../
 export LDFLAGS=-L/path/to/nonstandard/python/lib/; ./configure --prefix=/path/to/home/directory/gdb-7.11/ --with-python

注意:在这种情况下,最好同时清理顶层和 gdb 配置.清理顶级配置不会清理 gdb/configure.这让我有些难过.

NOTE : In this situation, it is best to clean both the top level and the gdb configures. Cleaning the top level configure will not clean the gdb/ configure. This gave me some grief.

相关文章