Tuesday, June 15, 2010

FreeBSD 8, Apache 2.2.14, Python 2.6.4, mod_wsgi 3.2 compile failure

This is a keyword laden post. I spent far too long trying to figure this out, and Google could not help me. Turns out it's really simple, but getting there was challenging, to put it mildly. Here goes:

/usr/local/include/pth/pthread.h:537:1: warning: this is the location of the previous definition
mod_wsgi.c: In function 'wsgi_discard_output':
mod_wsgi.c:11599: error: 'apr_bucket_type_t' has no member named 'pth_read'
mod_wsgi.c: In function 'wsgi_execute_remote':
mod_wsgi.c:12112: error: 'apr_bucket_type_t' has no member named 'pth_read'
apxs:Error: Command failed with rc=65536

If you are using the platform above, and get an error message that looks like that when building mod_wsgi 3.2, the problem is due to a configure option in your Python installation. Take the following steps:

cd /usr/ports/lang/python26
make config
make deinstall distclean
make install

Update the configuration, and disable GNU Pthreads. I'd also turn on SEM and THREADS, so that you can get the benefit of the multiprocessing module in Python 2.6.

Now, time to fix up mod_wsgi

cd /usr/ports/www/mod_wsgi3
make deinstall distclean
make install

And that will do it. You should now get everything working cleanly.

1 comment:

_alexii said...

Works! I've been fighting this fight in a bsd jail (and python 2.7 FWIW) and this was the cure.