17

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?

2
  • How did you solve this issue ? Following answers are not working for me . I have similar problem as yours Commented Feb 8, 2016 at 10:44
  • I honestly don't remember, sorry. :( It was 4 years ago when I had that problem... Commented Feb 8, 2016 at 16:23

7 Answers 7

24

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
Sign up to request clarification or add additional context in comments.

3 Comments

It worked in Ubuntu 12.04 compiling GDB 7.6. Installing python2.7-dev.
YMMD. On debian wheezy I had also to install python2.7-dev
apt-get install python3.5-dev works for me.
14

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

3 Comments

+1 It works. I compiled GDB 7.5.1 on OS X 10.6.8 without other problems.
Yep, this is the solution. Worked for me as well on OS X 10.6.8 when installing gdb 7.6.50.20130624 without having to install some other Python. I could just use my havily modified 2.7.5 install from python.org
Thanks for being verbose about how you debugged this. That was very helpful to me.
9

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>

1 Comment

This worked for me, but I had to configure and compile python with --enable-shared.
8

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

Comments

4

After many attempts, I managed to install gdb 13.1 on my ubuntu 22.04 by

 sudo apt-get install python3-dev

./configure --with-python=/usr/bin/python3

1 Comment

This looks like my best hope, but when I enter the command you've provided, here's the response: -bash: ./configure: No such file or directory. But I do have /usr/bin/python3 Can you clarify??
1

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

Comments

1

Just adding my own solution since I cannot see it among the rest here. In my case I was able to solve this by using configure as follows:

./configure --with-python=/usr/bin/python3

This was on a Ubuntu 22.04 machine. I suspect --with-python requires a full path to an existing python binary, so this seems like a much easier solution for standard distributions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.