So I've gotten mod_wsgi to compile cleanly, and it loads and
works fine under httpd -X (I can serve Hello World). However,
when I use apachectl, all processes simply die silently after
returning from wsgi_hook_init for the first time (i.e., after the
call to apr_pool_userdata_set). This is the case whether I use
the prefork or worker MPM.
Now I've built httpd w/o --enable-threads, and I'm getting this
error:
$ sudo httpd -X
Syntax error on line 37 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/local/apache2/modules/mod_wsgi.so into server:
/usr/local/apache2/modules/mod_wsgi.so: Undefined symbol
"pthread_attr_init"
Too much for my head now. I'll have to attack this again later.
chad
The pthread library functions are in -lc_r on some BSD boxes. Thus
need to ensure that Apache links with that when being compiled, or use
LD_PRELOAD environment variable at run time to get Apache to link the
reentrant C library first.
This can usually be done in envvars file in Apache bin directory.
LD_PRELOAD=/usr/lib/libc_r.so
export LD_PRELOAD
Graham
Deja vu:
http://www.modpython.org/pipermail/mod_python/2006-September/021986.html
:^)
Unfortunately I already have that line in envvars (from that previous
go-round with mod_python) and it's still not working. I'll try linking
it directly. Also, it occurs to me that I should look into Apache 2.2
+ FreeBSD wrt threading.
chad
What version of FreeBSD was it?
A few comments I have found:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200311.mbox/%3C2147483647.1068993287@localhost%3E
http://ivoras.sharanet.org/freebsd/gotchas.html
http://bugs.caucho.com/view.php?id=485
The last one suggests that maybe should preload /usr/lib/libpthread.so instead.
What other modules are you using with Apache?
What does the following yield?
nm /usr/lib/libc_r.so | grep pthread_attr_init
nm mod_wsgi.so | grep pthread_attr_init
How big is mod_wsgi.so, greater than 1MB indicating it has Python
library statically linked?
Graham
http://nixdoc.net/man-pages/FreeBSD/libmap.conf.5.html
That may be part of the answer.
ldd python
ldd httpd
to work out what dependencies these may have on the now multiple
thread libraries FreeBSD seems to provide. This may be of use in
working out what may be required in libmap.conf file.
Graham
Ouch! When I take the libc_r out of envvars, it works. :^)
Here's my write-up so far:
http://blag.whit537.org/2007/07/freebsd-threads-apache-and-modwsgi.html
Thanks for all the pointers, Graham!
chad
Interesting. I have updated my documentation on the issue to reflect
you latest finding.
http://code.google.com/p/modwsgi/wiki/InstallationIssues
Thanks for telling me the outcome.
Graham