a question on building MySQL-python

George Trojan george.trojan at noaa.gov
Fri Feb 19 17:25:34 CET 2010


During installation of MySQL-python-1.2.3c1 I encountered the following 
error:

$ python2.6 setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.6/MySQLdb
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.6
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'gamma',1) 
-D__version__=1.2.3c1 -I/usr/include/mysql 
-I/usr/local/Python-2.6.3/include/python2.6 -c _mysql.c -o 
build/temp.linux-x86_64-2.6/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-fno-strict-aliasing -fwrapv
gcc -pthread -shared build/temp.linux-x86_64-2.6/_mysql.o 
-L/usr/lib64/mysql -L/usr/lib64 -L. -lmysqlclient_r -lz -lpthread 
-lcrypt -lnsl -lm -lpthread -lssl -lcrypto -lpython2.6 -o 
build/lib.linux-x86_64-2.6/_mysql.so
/usr/bin/ld: cannot find -lpython2.6
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

Linker could not find libpython2.6.so. Note that the compiler *did* find 
Python include file: -I/usr/local/Python-2.6.3/include/python2.6.
I am running CentOS5.3. Python 2.6 was configured as follows:

$ TARGET=/usr/local/Python-2.6.3
$ export LDFLAGS=-Wl,-rpath,$TARGET/lib
$ ./configure --prefix=$TARGET \
         --with-cxx=g++ --with-threads --enable-shared

to avoid messing with LD_LIBRARY_PATH.
I managed to complete the installation by pasting the above link command 
  and adding proper -L option, but I would like to know what would be 
the proper fix.

George



More information about the Python-list mailing list