Hope this helps someone. I had some trouble compiling on IntelMac.
I installed the Universal.dmg of Python 2.4.3 from python.net and Universal MySQL 5 GA from mysql.com.
In order to make python setup.py build work, I symlinked /usr/local/mysql/bin/mysql_config
to /usr/bin/
ln -s /usr/local/mysql/bin/mysql_config /usr/bin/
No need to fiddle with site.cfg.
Unfortunately PYthon 2.4.3 compiles with -arch ppc with leads to an exception when you install & use the thus compiled module. Upon accessing the module you get a runtime exception
ImportError: Failure linking new module: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/_mysql.so: Symbol not found: _uncompress
Referenced from: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/_mysql.so
Expected in: dynamic lookup
I solved this by executing the build step with the "old" Python 2.3 which is supplied by Apple and part of Standard MacOS X installation:
python2.3 setup.py build
then I installed the module into my "new" Python 2.4 installation
python setup.py install
Everything works now. I am not sure whether there is an easier way to do this, since I've no idea how all this setup.py magic works. The -arch ppc vs. i386 thing might not even be the real reason why it broke, but anyway it works now, and perhaps someone might find this post useful :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First I also thought of a libz problem, but this doesn't explain, how both Pythons are able to compile & link in the first place, and why the variant compiled with the help of Py2.3 actually works...
mysql_config gives the following flags:
-I/usr/local/mysql/include -Os -arch i386 -fno-common
this seems okay.
Ah thanks for pointing me to the Makefile Python uses.
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/config/Makefile
lists "odd" things like
"BASECFLAGS= -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk "
and
LDFLAGS= -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
I've no idea, but I'm beginng to feel that those double -arch things my be some Apple trick, wich make the toolchain generating Universal Binaries (those work on PPC and x86 systems, basically two binary programs in one image)
Yeah, your Python-2.4 installation Makefile has the wrong arch flags. Change them to -arch i386 or remove them altogether and it should work. This is probably a packaging bug for Python-2.4. Considering that they must package for two different architectures now for the same platform, this isn't really a big surprise.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If it's not finding _uncompress, you are probably missing libz development files or something like that.
Also check your Python Makefile. On a typical Linux system this would be /usr/lib/python2.4/config/Makefile, but may be different on your system. This is where the compiler flags for Python are defined.
Also check the compiler flags mysql_config is giving you.
One of the two above things is giving you compiler flags for the wrong arch, and that can't be good.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
Hope this helps someone. I had some trouble compiling on IntelMac.
I installed the Universal.dmg of Python 2.4.3 from python.net and Universal MySQL 5 GA from mysql.com.
In order to make python setup.py build work, I symlinked /usr/local/mysql/bin/mysql_config
to /usr/bin/
ln -s /usr/local/mysql/bin/mysql_config /usr/bin/
No need to fiddle with site.cfg.
Unfortunately PYthon 2.4.3 compiles with -arch ppc with leads to an exception when you install & use the thus compiled module. Upon accessing the module you get a runtime exception
ImportError: Failure linking new module: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/_mysql.so: Symbol not found: _uncompress
Referenced from: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/_mysql.so
Expected in: dynamic lookup
I solved this by executing the build step with the "old" Python 2.3 which is supplied by Apple and part of Standard MacOS X installation:
python2.3 setup.py build
then I installed the module into my "new" Python 2.4 installation
python setup.py install
Everything works now. I am not sure whether there is an easier way to do this, since I've no idea how all this setup.py magic works. The -arch ppc vs. i386 thing might not even be the real reason why it broke, but anyway it works now, and perhaps someone might find this post useful :)
First I also thought of a libz problem, but this doesn't explain, how both Pythons are able to compile & link in the first place, and why the variant compiled with the help of Py2.3 actually works...
mysql_config gives the following flags:
-I/usr/local/mysql/include -Os -arch i386 -fno-common
this seems okay.
Ah thanks for pointing me to the Makefile Python uses.
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/config/Makefile
lists "odd" things like
"BASECFLAGS= -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk "
and
LDFLAGS= -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
I've no idea, but I'm beginng to feel that those double -arch things my be some Apple trick, wich make the toolchain generating Universal Binaries (those work on PPC and x86 systems, basically two binary programs in one image)
However /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/Makefile contains
BASECFLAGS= -fno-strict-aliasing -Wno-long-double -no-cpp-precomp
and
LDFLAGS= -Wl,-F. -Wl,-F.
So there's no arch at all (in the whole file). This might or might not be the reason for the problem, but it's definitely strange.
Yeah, your Python-2.4 installation Makefile has the wrong arch flags. Change them to -arch i386 or remove them altogether and it should work. This is probably a packaging bug for Python-2.4. Considering that they must package for two different architectures now for the same platform, this isn't really a big surprise.
If it's not finding _uncompress, you are probably missing libz development files or something like that.
Also check your Python Makefile. On a typical Linux system this would be /usr/lib/python2.4/config/Makefile, but may be different on your system. This is where the compiler flags for Python are defined.
Also check the compiler flags mysql_config is giving you.
One of the two above things is giving you compiler flags for the wrong arch, and that can't be good.