Check the output of mysql_config. I think your MySQL (or Python) may be built with a newer version of GCC than is being used on your system. -mtune is in gcc-3.4 but with gcc-3.3 and earlier, -mcpu should be used. -mcpu=i686 is in there, and it may be from either mysql_config or Python's build environment (look at /usr/lib/python2.4/config/Makefile and search for CFLAGS).
Thanks, now I have compiled manually to bypass the problem and there is another error:
$ gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -march=i486 -mcpu=i686 -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
_mysql.c:2804:45: warning: character constant too long for its type
_mysql.c: In function init_mysql':
_mysql.c:2805: warning: passing arg 1 ofPyRun_String' makes pointer from integer without a cast
_mysql.c:2808:52: too many decimal points in number
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have tested a lot of variantes:
-Dversion_info="(1,2,1,\"final\",2)"
-Dversion_info="(1,2,1,\'final\',2)"
-Dversion_info=\"(1,2,1,'final',2)\"
-Dversion_info='(1,2,1,"final",2)'
-Dversion_info='(1,2,1,\"final\",2)'
-Dversion_info=\'(1,2,1,"final",2)\'
-Dversion_info='(1,2,1,\'final\',2)'
-Dversion_info="(121)"
ecc...
...but the problem remain.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have wasted 3 houres for this and I do not found a solution.
My system: Slackware current, GCC 3.3.6, Python 2.4, MySQL 4.1.15.
This is the error:
$ python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.4/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mtune=i686 -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -march=i486 -mcpu=i686 -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
cc1: error: invalid option `tune=i686'
error: command 'gcc' failed with exit status 1
The variable "ext_mysql_metadata" in setup.py contain:
{'libraries': ['mysqlclient_r', 'z', 'pthread', 'crypt', 'nsl', 'm', 'pthread', 'ssl', 'crypto'], 'sources': ['_mysql.c'], 'name': '_mysql', 'extra_compile_args': ['-march=i486', '-mcpu=i686', '-Dversion_info="(1,2,1,\'final\',2)"', '-Dversion="1.2.1_p2"'], 'library_dirs': ['/usr/lib/mysql', '/usr/lib'], 'extra_objects': [], 'include_dirs': ['/usr/include/mysql']}
No CFLAGs environment variables.
How to solve this problem?
I have resolved editing the file /usr/lib/python/config/Makefile:
Compiler options
OPT= -DNDEBUG -O3 -march=i486 -mtune=i686
^^^^
whith:
Compiler options
OPT= -DNDEBUG -O3 -march=i486 -mcpu=i686
Byez!
By Davide "Design" Muzzarelli
Check the output of mysql_config. I think your MySQL (or Python) may be built with a newer version of GCC than is being used on your system. -mtune is in gcc-3.4 but with gcc-3.3 and earlier, -mcpu should be used. -mcpu=i686 is in there, and it may be from either mysql_config or Python's build environment (look at /usr/lib/python2.4/config/Makefile and search for CFLAGS).
http://gcc.gnu.org/gcc-3.4/changes.html
$ mysql_config
Usage: /usr/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/include/mysql -march=i486 -mcpu=i686]
--include [-I/usr/include/mysql]
--libs [-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto]
--libs_r [-L/usr/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto]
--socket [/var/run/mysql/mysql.sock]
--port [3306]
--version [4.1.15]
--libmysqld-libs [-L/usr/lib/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]
Thanks, now I have compiled manually to bypass the problem and there is another error:
$ gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -march=i486 -mcpu=i686 -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
_mysql.c:2804:45: warning: character constant too long for its type
_mysql.c: In function
init_mysql': _mysql.c:2805: warning: passing arg 1 of
PyRun_String' makes pointer from integer without a cast_mysql.c:2808:52: too many decimal points in number
Escape those double-quotes (") with backslashes when doing that from the shell.
I have tested a lot of variantes:
-Dversion_info="(1,2,1,\"final\",2)"
-Dversion_info="(1,2,1,\'final\',2)"
-Dversion_info=\"(1,2,1,'final',2)\"
-Dversion_info='(1,2,1,"final",2)'
-Dversion_info='(1,2,1,\"final\",2)'
-Dversion_info=\'(1,2,1,"final",2)\'
-Dversion_info='(1,2,1,\'final\',2)'
-Dversion_info="(121)"
ecc...
...but the problem remain.
What double-quotes?
$ gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mcpu=i686 -fPIC -I/usr/include/mysql -I/usr/include/python2.4 -c _mysql.c -o build/temp.linux-i686-2.4/_mysql.o -march=i486 -mcpu=i686 -Dversion_info="(1,2,1,'final',2)" -Dversion="1.2.1_p2"
Quotes (single and double) in -Dversion_info="(1,2,1,'final',2)" and -Dversion="1.2.1_p2" are correct...