Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python missing or unusable error while cross compiling GDB

Tags:

python

gdb

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?

like image 291
Andrew Avatar asked May 29 '12 03:05

Andrew


3 Answers

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
like image 194
pol Avatar answered Nov 02 '22 05:11

pol


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())
like image 27
fang Avatar answered Nov 02 '22 04:11

fang


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>
like image 7
hcma Avatar answered Nov 02 '22 03:11

hcma