交叉编译GDB时Python丢失或无法使用错误

And*_*rew 9 python gdb

尝试交叉编译GDB(使用--with-python标志)时出现此错误:

checking for python: /usr/bin/python
checking for python2.7: no
configure: error: python is missing or unusable
Run Code Online (Sandbox Code Playgroud)

我确保安装了python2.7 /usr/bin.我甚至删除了包并再次安装它.我试着用--with-python=/usr/bin--with-python=/usr/local,但没有运气.虽然我已经安装了2.7但我肯定知道.有什么想法吗?

小智 17

编译GDB 7.4.1时,我在Debian 6.0上遇到了同样的问题

解决方案是安装python头

sudo apt-get install python2.6-dev
Run Code Online (Sandbox Code Playgroud)

然后使用正确的标志进行配置

./configure --with-python
Run Code Online (Sandbox Code Playgroud)


fan*_*ang 12

我在使用gdb 7.4时遇到了同样的问题,并且在花了一些时间调试后终于使它工作了.

通过检查文件<gdb-source-path>/gdb/config.log,您会注意到一行:

configure:11031: gcc -o conftest -g -O2   -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7   conftest.c -lncurses -lz -lm    -L/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -ldl -framework CoreFoundation -lpython2.7 -u _PyMac_Error Python.framework/Versions/2.7/Python >&5
Run Code Online (Sandbox Code Playgroud)

似乎脚本python/python-config.py返回了一些导致gcc命令失败的无效标志.

解决方案是打开<gdb-source-directory>/gdb/python/python-config.py并注释掉这两行:

#            if getvar('LINKFORSHARED') is not None:
#                libs.extend(getvar('LINKFORSHARED').split())
Run Code Online (Sandbox Code Playgroud)


小智 5

我刚刚遇到了使用Continuum的Python 2.7构建gdb 7.8.1的类似问题,在我的例子中,它安装在非标准位置.

在这种情况下,解决方案是在运行'configure'之前提供额外的配置:

export LDFLAGS="-Wl,-rpath,<non-standard-Python-lib-location> -L<non-standard-Python-lib-location>"
configure --with-python=<non-standard-Python-executable-location>
Run Code Online (Sandbox Code Playgroud)


小智 5

我在构建ESP8266 SDK时遇到了这个错误.刚刚做了一个sudo apt-get install python-dev,现在它可以工作了.