15
votes

I get this error while attempting to cross-compile GDB (using the --with-python flag):

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

I made sure I had python2.7 installed in /usr/bin. I even removed the package and installed it again. I tried using --with-python=/usr/bin and --with-python=/usr/local, but no luck. I know for sure though that 2.7 is installed though. Any idea on what to do?

5
How did you solve this issue ? Following answers are not working for me . I have similar problem as yours - Punit Vara
I honestly don't remember, sorry. :( It was 4 years ago when I had that problem... - Andrew

5 Answers

21
votes

I had the same problem on Debian 6.0 when compiling GDB 7.4.1

The solution was to install python headers

sudo apt-get install python2.6-dev

and then configure with the right flag

./configure --with-python
12
votes

I had the same problem with gdb 7.4 and finally made it worked after spending some time debugging.

By checking the file <gdb-source-path>/gdb/config.log, you will notice one line:

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

Seems that the script python/python-config.py returned some invalid flags that caused the gcc command to fail.

The solution is to open <gdb-source-directory>/gdb/python/python-config.py and comment out these two lines:

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

I just came across a similar issue building gdb 7.8.1 using Continuum's Python 2.7, which, in my case, was installed in a non-standard location.

In this case, the solution was to provide an additional piece of configuration before running 'configure':

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

I hit this error building the ESP8266 SDK. Just did a sudo apt-get install python-dev and now it works.

0
votes

I came up with almost the same error building gdb 13.0.50 with python 3.8 for a more recent udpate. Running make after ./configure --with-python it shows python missing error. During compilation it seems to be looking for usr/bin/python for python 3.8 while we only have usr/bin/python3.

So I quickly changed the name of the python directory from usr/bin/python3 to usr/bin/python and it compiled and found python successfully.

Don't forget to change it back for dependencies