views:

587

answers:

1

I'm working on a Django project that requires debugging on a multithreaded server. I've found mod_wsgi 2.0+ to be the easiest to work with, because of easy workarounds for python module reloading. Problem is can't get it to compile on Leopard. Is there anyone who has managed to do it so far, either for the builtin Apache or MAMP. I'd be grateful if someone posts a link to a precompiled binary (for intel, python 2.5, apache 2.2 or 2.0).


After 3 hours of trial and error I've managed to compile mod_wsgi 2.3 for the Apache that comes with Leopard. Here are the instructions in case anyone else needs this.

  1. ./configure
  2. Change 2 lines in the Makefile

    CFLAGS = -Wc,'-arch i386'

    LDFLAGS = -arch i386 -Wl,-F/Library/Frameworks -framework Python -u _PyMac_Error

  3. make && sudo make install

  4. Make a thin binary of the original httpd

    cd /usr/sbin

    sudo mv ./httpd ./httpd.fat

    sudo lipo ./httpd.fat -thin i386 -output ./httpd.i386

    sudo ln -s ./httpd.i386 ./httpd

This should work on intel macbook, macbook pro, imac and mac mini. As I understood the problem is modwsgi won't compile against MacPython 2.5.2 because of some weird architecture missmatch problem. But, if you compile it as a thin binary it won't play with the Apache fat binary. So this hack solves the problem. The rest is pretty standard configuration, like on any other platform.

+2  A: 

This doesn't directly answer your question, but have you thought about using something like MacPorts for this sort of thing? If you're compiling a lot of software like this, MacPorts can really make your life easier, since building software and dependencies is practically automatic.

mipadi
I hate the MacPorts python. It has it's own issues that make my life harder.
Vasil
May I ask what issues? I've been using the MacPorts version for a pretty long time, with no major problems.
mipadi
I remember having lots of problems when trying to use virtualenv, some cryptographic libraries etc. Plus the Apache2 port was broken for a long period.
Vasil
The nice thing is that things change over time. Much like this board, users post fixes. You might want to revisit MacPorts.
Nerdling