On Mar 19, 2:26 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Mar 19, 9:47 am, geert <[EMAIL PROTECTED]> wrote: > > > > > On Mar 18, 6:56 pm, geert <[EMAIL PROTECTED]> wrote: > > > > On Mar 14, 1:15 pm, [EMAIL PROTECTED] wrote: > > > > > look > > > > athttp://groups.google.be/group/comp.lang.python/browse_thread/thread/d... > > > > > There is a macpython list that you can consult > > > > athttp://www.nabble.com/Python---pythonmac-sig-f2970.html > > > > Just wanted to let you know that I've solved my problem. The solution > > > is to compile mysql using > > > > MACOSX_DEPLOYMENT_TARGET=10.5 \ > > > CFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > > > LDFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > > > CXXFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ > > > ./configure --disable-dependency-tracking --enable-thread-safe-client > > > --prefix=/usr/local/mysql > > > > You then go this way to get it running on your machine: > > > >http://hivelogic.com/articles/installing-mysql-on-mac-os-x/ > > > > Then reinstall MySQLdb. Magic! > > > > Geert > > > Seems that I've yelled success to quickly. Everything's ok as long as > > I just run the django dev server, but moving to apache > > throughmod_wsgibrings a well-known but less than comforting complaint: > > > [Tue Mar 18 23:34:25 2008] [error] [client ::1]mod_wsgi(pid=2352): > > Exception occurred processing WSGI script '/Users/geert/Sites/LithoNET/ > > LN/LNApache.wsgi'., referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] Traceback (most recent > > call last):, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/core/handlers/wsgi.py", line 205, in > > __call__, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] response = > > self.get_response(request), referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/core/handlers/base.py", line 64, in > > get_response, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] response = > > middleware_method(request), referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/contrib/sessions/middleware.py", line > > 13, in process_request, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] engine = > > __import__(settings.SESSION_ENGINE, {}, {}, ['']), > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/contrib/sessions/backends/db.py", line > > 2, in <module>, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] from > > django.contrib.sessions.models import Session, > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/contrib/sessions/models.py", line 5, > > in <module>, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] from django.db > > import models, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/db/__init__.py", line 17, in <module>, > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] backend = > > __import__('%s%s.base' % (_import_path, settings.DATABASE_ENGINE), {}, > > {}, ['']), referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] File "/Library/ > > Python/2.5/site-packages/django/db/backends/mysql/base.py", line 12, > > in <module>, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] raise > > ImproperlyConfigured("Error loading MySQLdb module: %s" % e), > > referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] ImproperlyConfigured: > > Error loading MySQLdb module: dlopen(/Library/WebServer/.python-eggs/ > > MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/_mysql.so, 2): no > > suitable image found. Did find:, referer:http://localhost/images/ > > [Tue Mar 18 23:34:25 2008] [error] [client ::1] \t/Library/ > > WebServer/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg- > > tmp/_mysql.so: no matching architecture in universal wrapper, > > referer:http://localhost/images/ > > Did you again confirm that running: > > file /Library/WebServer/.python-eggs/MySQL_python-1.2.2-py2.5- > macosx-10.5-i386.egg-tmp/_mysql.so > > shows the .so having the required architectures, specifically what > Apache runs as (eg. x86_64)? > > Do the gcc compiler flags when building and linking the .so file show > all the architecture flags? > > Have you empty the Python egg cache to make sure it isn't an older > compiled version? > > Graham
Hi all, GOT IT! I have every running now. So, to sum it all up: I'm on a new intel mac with a 64-bit capable processor running macosx 10.5.2. I have httpd (apache2) running as a 64 bit app, which it would of course on a 64-bit machine. Activity monitor confirms this. I compiled mysql from source, configured as stated below: MACOSX_DEPLOYMENT_TARGET=10.5 \ CFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ LDFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ CXXFLAGS='-arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \ ./configure --disable-dependency-tracking --enable-thread-safe- client --prefix=/usr/local/mysql Then came mod_wsgi, just out of the box. Then came MySQLdb. Extracted the tar, then edited _mysql.c. Commented lines 37 - 39: //#ifndef uint //#define uint unsigned int //#endif and changed this: uint port = MYSQL_PORT; uint client_flag = 0; to this: unsigned int port = MYSQL_PORT; unsigned int client_flag = 0; on lines 484 and 485 Then - but I don't know if this is really (always) necessary, in site.cfg I changed Threadsafe = True to False. I set the ARCHFLAGS, but I don't think this helped one inch. ARCHFLAGS='-arch ppc -arch ppc64 -arch i386 -arch x86_64' OK. So then I went sudo python setup.py build. (I realise that the sudo isn't required just to do a build) There, I noticed this: creating build/temp.macosx-10.5-i386-2.5 gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused- madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes - DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -pipe - Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/local/mysql/ include/mysql -I/System/Library/Frameworks/Python.framework/Versions/ 2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.5-i386-2.5/ _mysql.o -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64 You see, here _mysql.o is being created. If you do file _mysql.o, you get: /Users/geert/Desktop/MySQL-python-1.2.2/build/temp.macosx-10.5- i386-2.5/_mysql.o: Mach-O universal binary with 4 architectures /Users/geert/Desktop/MySQL-python-1.2.2/build/temp.macosx-10.5- i386-2.5/_mysql.o (for architecture i386): Mach-O object i386 /Users/geert/Desktop/MySQL-python-1.2.2/build/temp.macosx-10.5- i386-2.5/_mysql.o (for architecture x86_64): Mach-O 64-bit object x86_64 /Users/geert/Desktop/MySQL-python-1.2.2/build/temp.macosx-10.5- i386-2.5/_mysql.o (for architecture ppc7400): Mach-O object ppc /Users/geert/Desktop/MySQL-python-1.2.2/build/temp.macosx-10.5- i386-2.5/_mysql.o (for architecture ppc64): Mach-O 64-bit object ppc64 which is ok. But, strangely, when _mysql.so is created in the next step, gcc doesn't add all the arch flags: gcc -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc build/temp.macosx-10.5-i386-2.5/_mysql.o -L/usr/local/mysql/lib/mysql - lmysqlclient -lz -lm -o build/lib.macosx-10.5-i386-2.5/_mysql.so and you end up with this: geert-dekkerss-imac:MySQL-python-1.2.2 geert$ file /Users/geert/ Desktop/MySQL-python-1.2.2/build/lib.macosx-10.5-i386-2.5/_mysql.so /Users/geert/Desktop/MySQL-python-1.2.2/build/lib.macosx-10.5-i386-2.5/ _mysql.so: Mach-O universal binary with 2 architectures /Users/geert/Desktop/MySQL-python-1.2.2/build/lib.macosx-10.5-i386-2.5/ _mysql.so (for architecture i386): Mach-O bundle i386 /Users/geert/Desktop/MySQL-python-1.2.2/build/lib.macosx-10.5-i386-2.5/ _mysql.so (for architecture ppc7400): Mach-O bundle ppc which is most definitely NOT ok. So I did this: sudo gcc -Wl,-F. -bundle -undefined dynamic_lookup -arch ppc -arch ppc64 -arch i386 -arch x86_64 build/temp.macosx-10.5-i386-2.5/_mysql.o -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -o build/ lib.macosx-10.5-i386-2.5/_mysql.so adding the arch flags myself, and running gcc again, under sudo. and lo and behold.... geert-dekkerss-imac:MySQL-python-1.2.2 geert$ file /Users/ geert/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg-tmp/ _mysql.so /Users/geert/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5- i386.egg-tmp/_mysql.so: Mach-O universal binary with 4 architectures /Users/geert/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5- i386.egg-tmp/_mysql.so (for architecture ppc7400): Mach-O bundle ppc /Users/geert/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5- i386.egg-tmp/_mysql.so (for architecture ppc64): Mach-O 64-bit bundle ppc64 /Users/geert/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5- i386.egg-tmp/_mysql.so (for architecture i386): Mach-O bundle i386 /Users/geert/.python-eggs/MySQL_python-1.2.2-py2.5-macosx-10.5- i386.egg-tmp/_mysql.so (for architecture x86_64): Mach-O 64-bit bundle x86_64 Well, it only took 20 years off my life span and all the hairs on my head :) Geert -- http://mail.python.org/mailman/listinfo/python-list