在Cent OS 5下编译gdb时,Python丢失或不可用



我检查了这个问题,它不适用。交叉编译GDB时Python丢失或不可用错误

我正在尝试构建gdb 7.5与python支持在Cent OS 5.

configure --with-expat --with-python 

不记录任何错误,Python开发文件已安装。

I set LDFLAGS="L/usr/local/expat-2.1 -L/opt/python27/lib

/opt/python27/lib包含:

rwxrwxrwx  1 root root      19 Mar 14 15:35 libpython2.7.so -> libpython2.7.so.1.0
-r-xr-xr-x  1 root root 1893448 Aug 30  2012 libpython2.7.so.1.0
drwxr-xr-x  2 root root    4096 Mar 14 15:35 pkgconfig
drwxr-xr-x 27 root root   20480 Mar 14 21:49 python2.7

运行make产生如下错误:

checking whether to use python... yes
checking for python... /opt/python27/bin/python
checking for python2.7... no
configure: error: python is missing or unusable

/opt/python27/bin/python存在,权限正确,可执行。

为什么链接进程找不到python?

configure: error:行之后的下一行应该是:

make[1]: [configure-gdb]: ....

告诉您这个错误来自于在GDB子目录中运行configure。所以你应该看看config.log文件。这应该会显示configure尝试做的一些失败的事情——可能是一段编译失败的C代码,编译器会给出一个错误消息,比如"无法找到包含文件"Python.h"。这告诉你问题是什么——它找不到用于在gdb中嵌入python的python头文件。

现在你的问题可能略有不同,但它可能与没有正确安装python嵌入组件有关。

为什么链接进程找不到python?

这不是链接过程;它是在其中一个子目录中的配置过程。

找出它是哪个子目录(make应该是Leaving directory XXXX),并在该子目录下的config.log中查找错误。

我发布的原因是config.log没有指向问题,但是当我运行make时,我从原始帖子

收到错误。

make进程运行附加 configure进程。您的错误是,显然是来自那个附加过程的。您声称已检查了所有子目录中的所有config.log s,但鉴于您所描述的症状,这似乎不太可能。

抱歉让你等了十年才得到答案。

在我的情况下,我查看了gdb/config.log文件,发现了这个:

configure:10369: checking for python2.7
configure:10387: gcc -o conftest -g -O2 -I/home/user/stevie-bsp/toolchain-build/builds/destdir/aarch64-host-linux-gnu/include -I/usr/include/python2.7 -I/usr/include/python2.7 -static-libstdc++ -static-libgcc  conftest.c -ldl -lncursesw -lm -ldl  -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions >&5
conftest.c:54:10: fatal error: Python.h: No such file or directory
   54 | #include "Python.h"
      |          ^~~~~~~~~~
compilation terminated.
当Python 2头文件没有安装时,

看起来像是一个误导性的错误信息。我在Ubuntu上修复了apt install python2-dev;在CentOS上,包名会有所不同。

其次,命令python必须启动Python 2解释器。构建过程不会给出关于此的明确错误,并且静默地无法查询Python头文件的包含路径。我通过使用Ubuntu上的python-is-python2软件包解决了这个问题。我不确定CentOS,但在最坏的情况下,你可以创建一个符号链接。

最新更新