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

时间:2012-05-29 03:49:27

标签: python gdb

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

checking for python: /usr/bin/python
checking for python2.7: no
configure: error: python is missing or unusable

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

4 个答案:

答案 0 :(得分:16)

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

解决方案是安装python header

sudo apt-get install python2.6-dev

然后使用右侧标志进行配置

./configure --with-python

答案 1 :(得分: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

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

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

#            if getvar('LINKFORSHARED') is not None:
#                libs.extend(getvar('LINKFORSHARED').split())

答案 2 :(得分:5)

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

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

export LDFLAGS="-Wl,-rpath,<non-standard-Python-lib-location> -L<non-standard-Python-lib-location>"
configure --with-python=<non-standard-Python-executable-location>

答案 3 :(得分:5)

我在构建ESP8266 SDK时遇到此错误。刚做了一个 sudo apt-get install python-dev 现在它有效。