Can anybody give me a hint about how to compile mysql-python on a 64bit system (see the error below)? I had no problems to install it on the x86 RHEL3, RH7, MacOSX but I'm new to the 64bit world.
Thanks in advance
Marc
python-2.3.4
MySQL-python-1.1.8
mysql-standard-4.1.8-x86_64-glibc23
(binary install from mysql.com)
python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
gcc -pthread -shared build/temp.linux-x86_64-2.3/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lssl -lcrypto -lz -lcrypt -o build/lib.linux-x86_64-2.3/_mysql.so
/usr/bin/ld: /usr/local/mysql/lib/libmysqlclient_r.a(libmysql.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/mysql/lib/libmysqlclient_r.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> /usr/bin/ld: /usr/local/mysql/lib/libmysqlclient_r.a(libmysql.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
I'm not sure what you mean by "binary install from mysql.com". Do you mean you have the RPMs from "(Linux AMD64 / Intel EM64T RPM (glibc-2.3, dynamic, gcc)" or a tarball like:
from "Linux downloads"? I am guessing you have the latter, but you would probably be better off with the RPM packaging.
Also look at the README for general Red Hat packaging requirements. If you indeed have the tarball installed, that probably has everything. With Red Hat, there are several RPM packages, so you can install just the parts you need. At the very least you need MySQL-devel.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for not being detailed enough. I installed the tarball version you mentioned above because Fedora Core 3 still comes with mysql-3.23.x with lots of dependencies. Therefore, I chose not to install the rpm but the tarball version. Maybe I just should get rid of the old mysql version and all its dependencies and install the latest mysql from the development version of Fedora...
I will post the same question on the mysql mailing list; maybe this is more a problem with the tarball than with mysql-python? Anyway, I will post any success here as well for the archive.
Thanks for you help, Andy.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just had the same compile error when trying to install the python image library. But now I am a little bit smarter than before because I could install the python image library after some changes.
Using what I have learned to install the python image library I changed the following in setup.py of mysql-python:
extra_compile_args = ['-O -fPIC']
As you can see below compilation almost completes without problems. Well, I don't really know what happens with all these options but I have the feeling that this is a small error in mysql-python: the compile arguments are added at the end even when there isn't a library anymore to be compiled. Of course, I can be completely wrong. Does anybody have some hints to solve this?
Dear List Members
Can anybody give me a hint about how to compile mysql-python on a 64bit system (see the error below)? I had no problems to install it on the x86 RHEL3, RH7, MacOSX but I'm new to the 64bit world.
Thanks in advance
Marc
(binary install from mysql.com)
python setup.py build
running build
running build_py
running build_ext
building '_mysql' extension
gcc -pthread -shared build/temp.linux-x86_64-2.3/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lssl -lcrypto -lz -lcrypt -o build/lib.linux-x86_64-2.3/_mysql.so
/usr/bin/ld: /usr/local/mysql/lib/libmysqlclient_r.a(libmysql.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/mysql/lib/libmysqlclient_r.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
> /usr/bin/ld: /usr/local/mysql/lib/libmysqlclient_r.a(libmysql.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
Do you have this installed?
http://dev.mysql.com/get/Downloads/MySQL-4.1/MySQL-devel-4.1.8-0.glibc23.x86_64.rpm/from/pick
I'm not sure what you mean by "binary install from mysql.com". Do you mean you have the RPMs from "(Linux AMD64 / Intel EM64T RPM (glibc-2.3, dynamic, gcc)" or a tarball like:
http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-standard-4.1.8-unknown-linux-x86_64-glibc23.tar.gz/from/pick
from "Linux downloads"? I am guessing you have the latter, but you would probably be better off with the RPM packaging.
Also look at the README for general Red Hat packaging requirements. If you indeed have the tarball installed, that probably has everything. With Red Hat, there are several RPM packages, so you can install just the parts you need. At the very least you need MySQL-devel.
Sorry for not being detailed enough. I installed the tarball version you mentioned above because Fedora Core 3 still comes with mysql-3.23.x with lots of dependencies. Therefore, I chose not to install the rpm but the tarball version. Maybe I just should get rid of the old mysql version and all its dependencies and install the latest mysql from the development version of Fedora...
I will post the same question on the mysql mailing list; maybe this is more a problem with the tarball than with mysql-python? Anyway, I will post any success here as well for the archive.
Thanks for you help, Andy.
I just had the same compile error when trying to install the python image library. But now I am a little bit smarter than before because I could install the python image library after some changes.
Using what I have learned to install the python image library I changed the following in setup.py of mysql-python:
extra_compile_args = ['-O -fPIC']
As you can see below compilation almost completes without problems. Well, I don't really know what happens with all these options but I have the feeling that this is a small error in mysql-python: the compile arguments are added at the end even when there isn't a library anymore to be compiled. Of course, I can be completely wrong. Does anybody have some hints to solve this?
Thanks, Marc
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/sets.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/stringtimes.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/mxdatetimes.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/pytimes.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 -I/usr/include/mysql -I/usr/local/python/Python-2.3.4/include/python2.3 -c _mysql.c -o build/temp.linux-x86_64-2.3/_mysql.o -O -fPIC
cc1: error: invalid option argument `-O -fPIC'
error: command 'gcc' failed with exit status 1
I think that I'm on the wrong path: I added the following to setup.py:
elif sys.platform == 'linux2' and os.getenv('HOSTTYPE') == 'x86_64':
extra_compile_args.append('-O -fPIC')
The problem persists. It seems that I have to recompile mysql by myself.
Regards,
Marc
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/sets.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/stringtimes.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/mxdatetimes.py -> build/lib.linux-x86_64-2.3/MySQLdb
copying MySQLdb/pytimes.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 -I/usr/include/mysql -I/usr/local/python/Python-2.3.4/include/python2.3 -c _mysql.c -o build/temp.linux-x86_64-2.3/_mysql.o
_mysql.c: In function
_mysql_ConnectionObject_Initialize': _mysql.c:429: warning: unused variable
value'_mysql.c:521: warning: label
error' defined but not used gcc -pthread -shared build/temp.linux-x86_64-2.3/_mysql.o -L/usr/local/mysql/lib -lmysqlclient -lz -lcrypt -o build/lib.linux-x86_64-2.3/_mysql.so /usr/bin/ld: /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): relocation R_X86_64_32 against
a local symbol' can not be used when making a shared object; recompile with -fPIC/usr/local/mysql/lib/libmysqlclient.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
O.k. compiled mysql from source with CFLAGS="-O -fPIC". Now I only get some warnings which I hopefully can ignore.
Regards,
Marc
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 -I/usr/local/mysql/include/mysql -I/usr/include/mysql -I/usr/local/python/Python-2.3.4/include/python2.3 -c _mysql.c -o build/temp.linux-x86_64-2.3/_mysql.o
_mysql.c: In function
_mysql_ConnectionObject_Initialize': _mysql.c:429: warning: unused variable
value'_mysql.c:521: warning: label `error' defined but not used
gcc -pthread -shared build/temp.linux-x86_64-2.3/_mysql.o -L/usr/local/mysql/lib -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -o build/lib.linux-x86_64-2.3/_mysql.so
I think those are related to SSL (or lack thereof when you build MySQL), so yes, they are safe to ignore.