I can't seem to get mod_wsgi to run under MAMP (1.8.4) + Snow Leopard
(10.6.2). Whenever I make a request to Apache dies with a Segmentation
fault error. Everything else about the setup works fine so long as
mod_wsgi is not enabled.

First: I know there are issues compiling mod_wsgi for MAMP, but I
addressed them by download the MAMP source and compiling a separate
copy of Apache so all of the build and include files were available
during the mod_wsgi build process.

Here's the whole procedure:

1. I installed Python 2.6.4 using the Mac installer disk image from
python.org.

2. I installed MAMP

3. I compiled Apache 2.0.63 from the MAMP source and moved the
relevant files (build and include) into the MAMP folder.

4. I download mod_wsgi-3.1.tar.gz, decompressed, and then ran:

        $ ./configure

Which returned the following:

        checking for apxs2... no
        checking for apxs... /Applications/MAMP/Library/bin/apxs
        checking Apache version... 2.0.63
        checking for python... /Library/Frameworks/Python.framework/Versions/
2.6/bin/python
        configure: creating ./config.status
        config.status: creating Makefile

Looks correct, it found MAMP's version of apache, and the latest
version of Python (that's the path to 2.6.4).

I checked the makefile, and the only suspicious thing was that
"LIBEXECDIR = /usr/local/apache2/modules". But that actually makes
sense since I have a symlink in "/usr/local" pointing apache2 to "/
Applications/MAMP/Library/".

5. So I go ahead and run make

        $ make

Builds fine, spits out the following:

        /Applications/MAMP/Library/bin/apxs -c -I/Library/Frameworks/
Python.framework/Versions/2.6/include/python2.6 -DNDEBUG  -Wc,'-arch
ppc' -Wc,'-arch i386' mod_wsgi.c -Wl,-F/Library/Frameworks -framework
Python -u _PyMac_Error   -arch ppc -arch i386 -ldl
        /Applications/MAMP/Library/build/libtool --silent --mode=compile gcc -
prefer-pic  -DAP_HAVE_DESIGNATED_INITIALIZER -DDARWIN -
DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -g -O2 -I/usr/local/
apache2/include  -I/Applications/MAMP/Library/include   -I/
Applications/MAMP/Library/include -I/Applications/MAMP/Library/include
-arch ppc -arch i386 -I/Library/Frameworks/Python.framework/Versions/
2.6/include/python2.6 -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch
mod_wsgi.slo
        /Applications/MAMP/Library/build/libtool --silent --mode=link gcc -o
mod_wsgi.la  -rpath /usr/local/apache2/modules -module -avoid-
version    mod_wsgi.lo -Wl,-F/Library/Frameworks -framework Python -u
_PyMac_Error -arch ppc -arch i386 -ldl

6. Now the install

        $ sudo make install

Which returns the following:

        /Applications/MAMP/Library/bin/apxs -i -S LIBEXECDIR=/usr/local/
apache2/modules -n 'mod_wsgi' mod_wsgi.la
        /Applications/MAMP/Library/build/instdso.sh SH_LIBTOOL='/Applications/
MAMP/Library/build/libtool' mod_wsgi.la /usr/local/apache2/modules
        /Applications/MAMP/Library/build/libtool --mode=install cp
mod_wsgi.la /usr/local/apache2/modules/
        libtool: install: cp .libs/mod_wsgi.so /usr/local/apache2/modules/
mod_wsgi.so
        libtool: install: cp .libs/mod_wsgi.lai /usr/local/apache2/modules/
mod_wsgi.la
        libtool: install: cp .libs/mod_wsgi.a /usr/local/apache2/modules/
mod_wsgi.a
        libtool: install: chmod 644 /usr/local/apache2/modules/mod_wsgi.a
        libtool: install: ranlib /usr/local/apache2/modules/mod_wsgi.a
        ----------------------------------------------------------------------
        Libraries have been installed in:
           /usr/local/apache2/modules

        If you ever happen to want to link against installed libraries
        in a given directory, LIBDIR, you must either use libtool, and
        specify the full pathname of the library, or use the `-LLIBDIR'
        flag during linking and do at least one of the following:
           - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
             during execution

        See any operating system documentation about shared libraries for
        more information, such as the ld(1) and ld.so(8) manual pages.
        ----------------------------------------------------------------------
        chmod 755 /usr/local/apache2/modules/mod_wsgi.so

Fair enough. I don't completely understand the note about the LIBDIR
situation. When I look in "/Applications/MAMP/Library/modules",
there's the "mod_wsgi.so" file, so I assume everything's ready to go.

8. In MAMP's "httpd.conf", I add the line "LoadModule wsgi_module
modules/mod_wsgi.so"

That's all for the the configuration.

Then, after firing up MAMP, the Apache logs suggests that everything
is going smoothly:

        [Sun Feb 14 16:58:17 2010] [notice] Apache/2.0.63 (Unix) DAV/2
mod_wsgi/3.1 Python/2.6.4 PHP/5.2.11 configured -- resuming normal
operations
        [Sun Feb 14 17:03:02 2010] [info] Server built: Dec 12 2009 11:39:11
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2566): Initializing
Python.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2568): Initializing
Python.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2569): Initializing
Python.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2567): Initializing
Python.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2565): Attach
interpreter ''.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2567): Attach
interpreter ''.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2569): Attach
interpreter ''.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2568): Attach
interpreter ''.
        [Sun Feb 14 17:03:02 2010] [info] mod_wsgi (pid=2566): Attach
interpreter ''.


But as soon as I make any kind of HTTP request, I get a dropped
connection error in my browser and the following in the Apache logs:

        [Sun Feb 14 17:03:29 2010] [notice] child pid 2575 exit signal
Segmentation fault (11)
        [Sun Feb 14 17:03:29 2010] [notice] child pid 2568 exit signal
Segmentation fault (11)
        [Sun Feb 14 17:03:29 2010] [notice] child pid 2566 exit signal
Segmentation fault (11)
        [Sun Feb 14 17:03:29 2010] [info] mod_wsgi (pid=2611): Initializing
Python.
        [Sun Feb 14 17:03:29 2010] [info] mod_wsgi (pid=2611): Attach
interpreter ''.

This happens 100% of the time. Again, when I disable the module in
"httpd.conf", everything's fine.

I've Googled very thoroughly, with no luck. It sounds like others have
gotten mod_wsgi working with MAMP, so it shouldn't be a lost cause.
(See: 
http://www.sitepen.com/blog/2008/05/16/supercharge-mamp/comment-page-1/#comment-87611)

The documentation says that segmentation faults are almost always the
result of conflicts with mod_python... but I've never even installed
mod_python.

I tried mod_wsgi 2.8, which also compiled fine, but also crashes
Apache. I tried manually specifying the LIBEXECDIR as "/Applications/
MAMP/Library/modules" in the makefile and then recompiling. I get the
same crash.

I'm far from an expert with the command line. Perhaps I made a stupid
mistake somewhere? It's hard to know where since the module compiles
without any complaints.

Any help is appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to