交叉编译GDB时出现Python丢失或不可用错误

2024-04-19 12:03:50 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试交叉编译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已经安装了。知道怎么办吗?


Tags: ornoforbinisconfigure标志usr
3条回答

我对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())

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

解决方案是安装python头文件

sudo apt-get install python2.6-dev

然后用正确的标志配置

./configure --with-python

我在构建ESP8266 SDK时遇到此错误。只是做了一个 sudo apt get安装python dev 现在它开始工作了。

相关问题 更多 >