Skip navigation links

MySQL Forums


Advanced Search

Re: Problems in building 1.2.2 on Mac OS 10.5
Posted by: Joseph Gilbert ()
Date: July 08, 2008 08:50AM

I got it working a little differently.

First you need to fix the unsigned int problem in _mysql.c
_mysql.c

//comment this out
37 //#ifndef uint
38 //#define uint unsigned int
39 //#endif

//change the unit back to unsigned int
484 unit port = MYSQL_PORT; -> unsigned int port = MYSQL_PORT;
485 unit client_flag = 0; -> unsigned int client_flag = 0;

Now when you build the extension it will tell you it's in the wrong architecture. I'm not exactly sure what's going on here but I'm running osx 10.5 on an Intel processor and all Intel boxes have everything build for i386 (x86) only. So all the mysql libraries are i386 only. I'm using a Framework version of python which is a universal build. If you add -arch ppc to the setup_posix.py file you'll get the error that mysqlclient_r.lib is in the wrong architecture. I'm assume therefore that the extension needs to be built as a universal. Therefore I downloaded the osx-10.4 universal mysql build and put in in a local area and built off it.

To get mysqldb to build against the universal build uncomment the line in site.cfg and point it to the right place.

site.cfg
mysql_config = /Users/blah/Make/mysql-5.0.51a-osx10.4-universal/bin/mysql_config

now type:
python setup.py build
sudo python setup.py install

and everything should go ok
type:
python
import MySQLdb

and you'll get the following warning:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-i386.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-i386.egg/_mysql.pyc, but /Users/jgilbert/Make/MySQL-python-1.2.2 is being added to sys.path
import sys, pkg_resources, imp

I haven't figured this one out yet. However the library works correctly.

>>> conn = MySQLdb.connect(host = "HOST", user = "USER", passwd = "PASS", db = "DATABASE")
>>> cursor = conn.cursor()
>>> cursor.execute("SELECT VERSION()")
1L
>>> row = cursor.fetchone()
>>> print "server version:", row[0]
server version: 5.0.45-log
>>> cursor.close()
>>> conn.close()

p.s. I can't wait till all macs are intel only....



Edited 1 time(s). Last edit at 07/08/2008 08:56AM by Joseph Gilbert.

Options: ReplyQuote


Subject Written By Posted
Problems in building 1.2.2 on Mac OS 10.5 Mr Stone 09/26/2007 02:12PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Jeremy Knope 10/27/2007 12:41PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Oliver Beattie 10/27/2007 02:35PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Oliver Beattie 10/27/2007 02:44PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Michal Kox 10/27/2007 04:06PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Geert Dekkers 03/13/2008 02:05AM
Re: Problems in building 1.2.2 on Mac OS 10.5 Joseph Gilbert 07/08/2008 08:50AM
Re: Problems in building 1.2.2 on Mac OS 10.5 Jone Black 03/28/2009 09:07AM
Re: Problems in building 1.2.2 on Mac OS 10.5 Brent Nash 01/29/2008 12:12PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Patrick Crews 04/12/2008 04:10PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Jesper Kückelhahn 10/28/2007 10:36AM
Re: Problems in building 1.2.2 on Mac OS 10.5 Jason Evans 11/27/2007 12:25AM
Re: Problems in building 1.2.2 on Mac OS 10.5 Andy Fundinger 12/11/2007 02:48PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Bjarni Vilhjalmsson 02/25/2008 12:40PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Ches Martin 07/20/2008 11:40PM
Re: Problems in building 1.2.2 on Mac OS 10.5 Maarten Idema 09/29/2008 05:30AM
Re: Problems in building 1.2.2 on Mac OS 10.5 M Hess 12/29/2008 02:09AM
Re: Problems in building 1.2.2 on Mac OS 10.5 Eva Heinz 11/24/2008 04:24AM
Re: Problems in building 1.2.2 on Mac OS 10.5 Jose Muanis Castro 06/13/2009 05:55PM


Sorry, you can't reply to this topic. It has been closed.