I was hoping to build MySQLdb with static libraries, since I've chrooted my MySQL, but I ran into problems all the way.
Firstly the tarball for MySQL-python-0.9.3b3.tar.gz seems to be broken, because I get this:
# tar xzvf MySQL-python-0.9.3b3.tar.gz
MySQL-python-0.9.3b3/
tar: Skipping to next file header
gzip: stdin: invalid compressed data--crc error
tar: Child returned status 1
tar: Error exit delayed from previous errors
So I tried the MySQL-python-0.9.3b2.tar.gz, which at least seemed to have an intact tarball.
First I tried to build with static libraries by pointing to them in extra_objects = [] in setup.py (after adding my non-standard directories to the include_dirs and library_dirs as appropriate), but the linker still seemed to give gcc the -shared option:
(does that -shared mean "static linking" is not available? can you turn that off somewhere?)
The build process doesn't complain, but when I install and try to import the MySQLdb, I get the familiar:
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line 27, in ?
import _mysql
ImportError: libmysqlclient.so.12: cannot open shared object file: No such file or directory
Clearly the module is not using the static library. And besides, the file /opt/mysqlamp/lib/mysql/libmysqlclient.so.12 does exist if that's of any consolation.
Next I gave up on the notion, that I'd get MySQLdb to work with static linking and just tried to get it to work somehow, and maybe figure my problems out that way. Unfortunately making the extra_objects = []
didn't help much as the build and install still made no sound, but importing gave the same not found error.
Then I tried to give the linker its parameters with the LD_LIBRARY_PATH variable, but got the same end results.
I also tried all this with the stable MySQL-python-0.9.2, to no avail. Then I ran out of ideas, started reading and finally gave up and posted this message.
My Python is 2.3.3 and my GCC is 2.95.3 and I'm running a i586-pc-linux-gnu, with the 2.4.18 kernel on an LFS 3.3 based personal distro.
Can anyone point me in some meaningful direction?
I've read the FAQs, googled for answers, read all the postings on this project site and gnawed my fingers.
-Jan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
I was hoping to build MySQLdb with static libraries, since I've chrooted my MySQL, but I ran into problems all the way.
Firstly the tarball for MySQL-python-0.9.3b3.tar.gz seems to be broken, because I get this:
# tar xzvf MySQL-python-0.9.3b3.tar.gz
MySQL-python-0.9.3b3/
tar: Skipping to next file header
gzip: stdin: invalid compressed data--crc error
tar: Child returned status 1
tar: Error exit delayed from previous errors
So I tried the MySQL-python-0.9.3b2.tar.gz, which at least seemed to have an intact tarball.
First I tried to build with static libraries by pointing to them in extra_objects = [] in setup.py (after adding my non-standard directories to the include_dirs and library_dirs as appropriate), but the linker still seemed to give gcc the -shared option:
include_dirs = [
'/usr/include/mysql', '/usr/local/include/mysql',
'/usr/local/mysql/include/mysql', '/opt/mysqlamp/include/mysql/'
]
library_dirs = [
'/usr/lib/mysql', '/usr/local/lib/mysql',
'/usr/local/mysql/lib/mysql', '/opt/mysqlamp/lib/mysql/'
]
extra_objects = ['/opt/mysqlamp/lib/mysql/libmysqlclient.a']
(BTW is my syntax even right?)
# python setup.py build
...
gcc -pthread -shared build/temp.linux-i586-2.3/_mysql.o /opt/mysqlamp/lib/mysql/libmysqlclient.a -L/usr/lib/mysql -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/opt/mysqlamp/lib/mysql/ -lmysqlclient -lz -o build/lib.linux-i586-2.3/_mysql.so
(does that -shared mean "static linking" is not available? can you turn that off somewhere?)
The build process doesn't complain, but when I install and try to import the MySQLdb, I get the familiar:
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/site-packages/MySQLdb/__init__.py", line 27, in ?
import _mysql
ImportError: libmysqlclient.so.12: cannot open shared object file: No such file or directory
Clearly the module is not using the static library. And besides, the file /opt/mysqlamp/lib/mysql/libmysqlclient.so.12 does exist if that's of any consolation.
Next I gave up on the notion, that I'd get MySQLdb to work with static linking and just tried to get it to work somehow, and maybe figure my problems out that way. Unfortunately making the extra_objects = []
didn't help much as the build and install still made no sound, but importing gave the same not found error.
Then I tried to give the linker its parameters with the LD_LIBRARY_PATH variable, but got the same end results.
I also tried all this with the stable MySQL-python-0.9.2, to no avail. Then I ran out of ideas, started reading and finally gave up and posted this message.
My Python is 2.3.3 and my GCC is 2.95.3 and I'm running a i586-pc-linux-gnu, with the 2.4.18 kernel on an LFS 3.3 based personal distro.
Can anyone point me in some meaningful direction?
I've read the FAQs, googled for answers, read all the postings on this project site and gnawed my fingers.
-Jan