MySQL Forums
Forum List  »  Connector/Python

Re: MySQLdb Install Linux Not Working
Posted by: Kharlamov Igor
Date: January 28, 2008 09:59AM

Could somebody explain of MySQL-python installation issue:

1.Linux localhost 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64 x86_64 x86_64 GNU/Linux

2.python2.3: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

3.MySQL4.1.22
4.MySQL-python-1.2.1

MySQL-python site.cfg:
[zope@mos-doc3 MySQL-python-1.2.1]$ cat site.cfg
# Options:
#
# embedded: link against the embedded server library
# threadsafe: use the threadsafe client
# static: link against a static library (probably required for embedded)

[options]
embedded = False
threadsafe = True
static = False

# Use the compiler section to add additional options for the extension build.
# In particular, if your platform does not support mysql_config (like
# Windows), you will have to set most of these. Note that each entry is split
# into a list so that each line is one item.

[compiler]
#mysql_root: /usr/local/mysql
#library_dirs: %(mysql_root)s/lib
#include_dirs: %(mysql_root)s/include
#libraries: mysqlclient
# zlib
# msvcrt
# libcmt
# wsock32
# advapi32
#extra_compile_args:
#extra_objects:


Issue is:

[zope@mos-doc3 MySQL-python-1.2.1]$ python2.3 setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.3
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.3
creating build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.3/MySQLdb
creating build/lib.linux-x86_64-2.3/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.3/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.3/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.3/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.3/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.3/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.3/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.3/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.3
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/mysql/include/mysql -I/usr/local/include/python2.3 -c _mysql.c -o build/temp.linux-x86_64-2.3/_mysql.o -Dversion_info="(1,2,1,'final',1)" -D__version__="1.2.1"
gcc -pthread -shared build/temp.linux-x86_64-2.3/_mysql.o -L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -o build/lib.linux-x86_64-2.3/_mysql.so
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

I can't build package at all. When i set threadsafe = False:

[zope@mos-doc3 MySQL-python-1.2.1]$ python2.3
Python 2.3.6 (#1, Dec 28 2007, 12:39:17)
[GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "MySQLdb/__init__.py", line 19, in ?
import _mysql
ImportError: libmysqlclient.so.15: cannot open shared object file: No such file or directory

But, in the mysql location i have:

[zope@mos-doc3 mysql]$ pwd
/usr/local/mysql/lib/mysql
[zope@mos-doc3 mysql]$ ls -la
total 2636
drwxr-xr-x 2 root mysql 4096 Jan 28 17:07 .
drwxr-xr-x 3 root mysql 4096 Jan 28 17:07 ..
-rw-r--r-- 1 root mysql 21432 Jan 28 17:07 libdbug.a
-rw-r--r-- 1 root mysql 73048 Jan 28 17:07 libheap.a
-rw-r--r-- 1 root mysql 465608 Jan 28 17:07 libmyisam.a
-rw-r--r-- 1 root mysql 41978 Jan 28 17:07 libmyisammrg.a
-rw-r--r-- 1 root mysql 731340 Jan 28 17:07 libmysqlclient.a
-rwxr-xr-x 1 root mysql 879 Jan 28 17:07 libmysqlclient.la
lrwxrwxrwx 1 root mysql 24 Jan 28 17:07 libmysqlclient.so -> libmysqlclient.so.15.0.0
lrwxrwxrwx 1 root mysql 24 Jan 28 17:07 libmysqlclient.so.15 -> libmysqlclient.so.15.0.0
-rwxr-xr-x 1 root mysql 499396 Jan 28 17:07 libmysqlclient.so.15.0.0
-rw-r--r-- 1 root mysql 352596 Jan 28 17:07 libmystrings.a
-rw-r--r-- 1 root mysql 448504 Jan 28 17:07 libmysys.a
-rw-r--r-- 1 root mysql 11890 Jan 28 17:07 libvio.a


I don't understand what to do ((.

Options: ReplyQuote


Subject
Written By
Posted
Re: MySQLdb Install Linux Not Working
January 28, 2008 09:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.