I know it's mentioned in the docs, but (after 3 days of research) I
though I'd post this here for the benefit of anyone else facing the
same issue since, searching the mail archive, I found the exact error
only here, and needed to make a decision about which way forward to
take:
http://groups.google.com/group/modwsgi/browse_thread/thread/42de104289d6b26f
My local staging setup (for testing Django with mod_wsgi before
deployment - mod_wsgi is already running happily on our Debian server,
although not yet with Django):
OS X 10.5.8 (MacBook Intel Core 2 Duo)
Apache 2.2.14 (was Intel 64 bit, now 32 bit - see below)
mod_wsgi 3.3
Python 2.6.4 (32 bit from
http://www.python.org/download/releases/2.6.5/)
I'd already decided to go 32 bit to run MySQL-python with Django under
the 32-bit Python 2.6 OS X package:
http://stackoverflow.com/questions/1969222/mysql-python-1-2-3-and-os-x-10-5-64-or-32-bit
BTW activity Monitor shows that the *only* other process running as
Intel 64 bit apart from httpd is Growl!
However, as from Python 2.7 the OS X installer is 64 bit:
http://bugs.python.org/issue9045
but since many Python modules aren't yet 64 bit, it seems simpler to
stay on 32 bit until they've caught up, and/or I upgrade to OS X 10.6
(Snow Leopard). Unless anyone has better advice?
#####
Here's the journey:
Having installed mod_wsgi 3.3 and noted the following warnings:
ld warning: in /Library/Frameworks/Python.framework/Python, missing
required architecture ppc64 in file
ld warning: in /Library/Frameworks/Python.framework/Python, missing
required architecture x86_64 in file
but (not heeding that 'warnings are errors') I added the module to
httpd.config anyway and got:
$ apachectl configtest
httpd: Syntax error on line 115 of /private/etc/apache2/httpd.conf:
Cannot load /usr/libexec/apache2/mod_wsgi.so into server: dlopen(/usr/
libexec/apache2/mod_wsgi.so, 10): Symbol not found: _PyExc_RuntimeError
\n Referenced from: /usr/libexec/apache2/mod_wsgi.so\n Expected in:
dynamic lookup\n
Having read all the relevant docs and checked the LDFLAGS in
configure.ac and the Makefile - both now read as suggested in the old
post to this group - (and spent 2 days looking for similar errors and
opinions) I came to the conclusion that the problem was with Apache2
running as 64-bit, with a 32-bit Python 2.6.
Following the mod_wsgi docs I got readouts from 'otool' and 'file':
$ otool -L mod_wsgi.so
mod_wsgi.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 111.1.5)
/Library/Frameworks/Python.framework/Versions/2.6/Python
(compatibility version 2.6.0, current version 2.6.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
- no problem.
$ file /usr/libexec/apache2/mod_wsgi.so
/usr/libexec/apache2/mod_wsgi.so: Mach-O universal binary with 4
architectures
/usr/libexec/apache2/mod_wsgi.so (for architecture ppc7400): Mach-O
bundle ppc
/usr/libexec/apache2/mod_wsgi.so (for architecture ppc64): Mach-O 64-
bit bundle ppc64
/usr/libexec/apache2/mod_wsgi.so (for architecture i386): Mach-O
bundle i386
/usr/libexec/apache2/mod_wsgi.so (for architecture x86_64): Mach-O 64-
bit bundle x86_64
- fine, just like all the other Apache2 modules.
$ file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O universal binary with 4 architectures
/usr/sbin/httpd (for architecture ppc7400): Mach-O executable ppc
/usr/sbin/httpd (for architecture ppc64): Mach-O 64-bit executable
ppc64
/usr/sbin/httpd (for architecture i386): Mach-O executable i386
/usr/sbin/httpd (for architecture x86_64): Mach-O 64-bit executable
x86_64
- hmmm... check in Activity Monitor, Apache is listed as 'Intel (64
bit)', although it can obviously run 32 bit.
$ file /Library/Frameworks/Python.framework/Versions/2.6/bin/python
/Library/Frameworks/Python.framework/Versions/2.6/bin/python: Mach-O
universal binary with 2 architectures
/Library/Frameworks/Python.framework/Versions/2.6/bin/python (for
architecture ppc): Mach-O executable ppc
/Library/Frameworks/Python.framework/Versions/2.6/bin/python (for
architecture i386): Mach-O executable i386
- which shows that my Python 2.6 install is 32 bit and *cannot* run as
64 bit.
So following advice in the docs I decided to make Apache also run 32-
bit, adapting the (similar to Graham's) instructions for Intel from
here:
http://codesnippets.joyent.com/posts/show/1328
sudo mv /usr/sbin/httpd /usr/sbin/httpd.ub
sudo lipo -thin i386 /usr/sbin/httpd.ub -output /usr/sbin/httpd.i386
sudo ln -s /usr/sbin/httpd.i386 /usr/sbin/httpd
$ apachectl configtest
Syntax OK
To restore Apache to 64 bit mode, just type:
sudo mv /usr/sbin/httpd.ub /usr/sbin/httpd
...and watch out for OS X system updates that might overwrite httpd.
I hope that helps anyone else in the same boat, and explains this
particular issue in detail.