MySQL Forums
Forum List  »  Connector/Python

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
Re: Problems in building 1.2.2 on Mac OS 10.5
July 08, 2008 08:50AM


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

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.