[Pythonmac-SIG] MySQLdb on OS X 10.6

Emanuele Santos emanuelesantos at gmail.com
Thu Nov 12 01:38:33 CET 2009


Hi, Brian

I don't think python2.5 shipped with Snow Leopard is 64 bit.
If you want to build using pyhton 2.5 it will have to be 32bit.

-- Emanuele.

On Nov 11, 2009, at 5:28 PM, Brian Zambrano wrote:

> Hi all,
>
> Like many others before me, I'm banging my head against the wall  
> trying to get MySQLdb working on my new MacBook Pro with Snow Leopard.
>
> I have MySql 5.1 x86_64 installed, configured and running.  I'm  
> building MySQLdb 1.2.3c1 like this:
>
>   export ARCHFLAGS='-arch x86_64'
>   python setup.py  build
>   python setup.py  install
>
> But it simply doesn't work....and apparently I'm not the only one:
>
> (eb)brianz at eb-brianz$ python -c "import MySQLdb"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "MySQLdb/__init__.py", line 19, in <module>
>     import _mysql
> ImportError: dlopen(./_mysql.so, 2): no suitable image found.  Did  
> find:
>         ./_mysql.so: mach-o, but wrong architecture
>
> Everything *looks* ok:
>
> (eb)brianz at eb-brianz$ file _mysql.so
> _mysql.so: Mach-O 64-bit bundle x86_64
>
> (eb)brianz at eb-brianz$ otool -L _mysql.so
> _mysql.so:
>         /usr/local/mysql/lib/libmysqlclient_r.16.dylib  
> (compatibility version 17.0.0, current version 17.0.0)
>         /usr/lib/libz.1.dylib (compatibility version 1.0.0, current  
> version 1.2.3)
>         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,  
> current version 124.1.1)
> (eb)brianz at eb-brianz$
> (eb)brianz at eb-brianz$ file /usr/local/mysql/lib/libmysqlclient_r. 
> 16.dylib
> /usr/local/mysql/lib/libmysqlclient_r.16.dylib: Mach-O 64-bit  
> dynamically linked shared library x86_64
>
> Huh?  Something is not right here.  It sucks that the OS X builds  
> are so painful.  I'm sort of at a loss at where to go next.   
> Suggestions?
>
> Any help greatly appreciated!
> BZ
>
>
> BTW...here are the relevant lines from the build:
>
> creating build/temp.macosx-10.6-i386-2.5
> gcc-4.2 -fno-strict-aliasing -mno-fused-madd -fno-common -dynamic - 
> DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/ 
> include/ffi -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'gamma',1) - 
> D__version__=1.2.3c1 -I/usr/local/mysql/include -I/System/Library/ 
> Frameworks/Python.framework/Versions/2.5/include/python2.5 -c  
> _mysql.c -o build/temp.macosx-10.6-i386-2.5/_mysql.o -g -Os -arch  
> x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE - 
> DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT - 
> DDONT_DECLARE_CXA_PURE_VIRTUAL
> In file included from _mysql.c:36:
> /usr/local/mysql/include/my_config.h:1049:1: warning: "HAVE_WCSCOLL"  
> redefined
> In file included from /System/Library/Frameworks/Python.framework/ 
> Versions/2.5/include/python2.5/Python.h:8,
>                  from pymemcompat.h:10,
>                  from _mysql.c:29:
> /System/Library/Frameworks/Python.framework/Versions/2.5/include/ 
> python2.5/pyconfig.h:725:1: warning: this is the location of the  
> previous definition
> gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -arch x86_64 build/ 
> temp.macosx-10.6-i386-2.5/_mysql.o -L/usr/local/mysql/lib - 
> lmysqlclient_r -lz -lm -lmygcc -o build/lib.macosx-10.6-i386-2.5/ 
> _mysql.so
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig

-- Emanuele.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20091111/5a50ade3/attachment.htm>


More information about the Pythonmac-SIG mailing list