5
Nov
MySQLdb on Leopard
As many people probably have, I ran across the problem of installing MySQLdb (Python) on Leopard today.
The error:
In file included from /usr/local/mysql/include/mysql.h:43, from _mysql.c:40: /usr/include/sys/types.h:92: error: duplicate 'unsigned' /usr/include/sys/types.h:92: error: two or more data types in declaration specifiers error: Setup script exited with error: command 'gcc' failed with exit status 1
Luckily, there are people out there who know a lot more than me about these things, and someone had already found a fix:
To get mysqldb working on leopard I found I had to edit _mysql.c and edit out the lines:
#ifndef uint #define uint unsigned int #endifI also had to edit site.cfg and mark threadsafe to False.
After doing this, I managed to get MySQLdb to install, great! Not so fast, there was yet another problem:
Referenced from: .../_mysql.so Reason: image not found
The solution:
sudo ln -s /usr/local/mysql/lib/ /usr/local/mysql/lib/mysql
6 Responses to "MySQLdb on Leopard"
Worked perfectly. Thanks for sharing!
This is one of the more frustrating builds I’ve come across in recent memory…
Everything build fine but it still doesn’t work…
I keep getting the following error
{{{
ImproperlyConfigured: Error loading MySQLdb module: dlopen(/var/tmp/.python_eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/var/tmp/.python_eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so: no matching architecture in universal wrapper
}}}
any ideas?
[…] David Cramer’s Blog […]
[…] you need to edit the download MySQLdb sources file _mysql.c (as perĀ thisĀ ) and remove the following lines near the top#ifndef uint #define uint unsigned int […]
Awesome, thank you very much for the post, compiling worked like a charm after the edit and linking.
Thanks for sharing,
Wim.
Leave A Reply