Mac OS X 10.7.4 & mod_wsgi.so

726 views
Skip to first unread message

Abilard

unread,
May 16, 2012, 3:47:17 PM5/16/12
to mod...@googlegroups.com
Yesterday I installed Apache 2.4.2 on Mac OS X 10.7.4, creating a plist file to launch it at boot (Apple's built-in web sharing is turned off).  MySQL and PHP were installed next:

PHP 5.3.10 with Suhosin-Patch (cli) 
mysql  Ver 14.14 Distrib 5.5.24, for osx10.6 (i386)

The PHP module (libphp5.so) is running happily.  I then attempted to setup Apache to handle Python through mod_wsgi.so and am encountering the following error when I test the config file:

httpd: Syntax error on line 149 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_wsgi.so into server: dlopen(/usr/local/apache2/modules/mod_wsgi.so, 10): Symbol not found: _ap_accept_lock_mech\n  Referenced from: /usr/local/apache2/modules/mod_wsgi.so\n  Expected in: flat namespace\n in /usr/local/apache2/modules/mod_wsgi.so

Searching the web turned up these hypotheses as to what might cause errors of this kind:
  1. Mixing 64-bit Apache and 32-bit Python.
  2. Running old versions of Python.
  3. Having multiple versions of Apache.
  4. Not using MacPorts.
  5. Not using HomeBrew.
  6. Not using Linux.
I've attempted forcing Apache to run in 32-bit mode; putting Python 3.2 in the path; specifying apxs2 & python during configure; altering the Makefile to ensure proper architecture; using MacPorts; installing HomeBrew and running the other way; and half a dozen other things I have forgotten now to no avail.  As for #6, my Ubuntu dev box is running mod_python just fine.  My goal is getting my MacBook Pro to run mod_wsgi.so (which, I gather, is now preferred over mod_python).

Any ideas?

Graham Dumpleton

unread,
May 16, 2012, 5:29:58 PM5/16/12
to mod...@googlegroups.com, mod...@googlegroups.com, Graham Dumpleton


You cannot use mod_wsgi 3.3 source code or precompiled binary, you need to use 3.X or 4.X branches from mod_wsgi source code repository. What code or binary were you using?

Graham
--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To view this discussion on the web visit https://groups.google.com/d/msg/modwsgi/-/-8UvZJ9UJCoJ.
To post to this group, send email to mod...@googlegroups.com.
To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.

Kevin King

unread,
May 16, 2012, 7:20:02 PM5/16/12
to mod...@googlegroups.com
Most of my attempts were with version 3.3, though at one point I did install Mercurial and pull the latest from source.  No luck there either, though I do not recall whether the error for that one differed.  So perhaps I should limit my efforts to the latest from the repository?

Kevin

Kevin King

unread,
May 16, 2012, 7:48:07 PM5/16/12
to mod...@googlegroups.com
I re-ran the code from the Mercurial clone (last modified Mon May 07 17:15:19 2012 +1000; 4.0-trunk) and the similar error resulted:

sh-3.2# /usr/local/apache2/bin/apachectl -t
httpd: Syntax error on line 149 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_wsgi.so into server: dlopen(/usr/local/apache2/modules/mod_wsgi.so, 10): Symbol not found: __Py_FalseStruct\n  Referenced from: /usr/local/apache2/modules/mod_wsgi.so\n  Expected in: flat namespace\n in /usr/local/apache2/modules/mod_wsgi.so

This time it is not finding " __Py_FalseStruct" while version 3.3 was having issues with "__ap_accept_lock_mech".  Not sure if this can be interpreted as progress, but perhaps it is a clue.  ;-)

Kevin

Graham Dumpleton

unread,
May 16, 2012, 7:56:43 PM5/16/12
to mod...@googlegroups.com
At a guess you have multiple Python versions installed and not using
the standard default Apple Python version.

When you configure mod_wsgi before building, add the configure option:

--disable-framework

Framework linking seems to have been screwed up again on Lion for non
default Python versions and need to use more traditional UNIX -L
linking style.

Graham

Abilard

unread,
May 16, 2012, 8:49:09 PM5/16/12
to mod...@googlegroups.com
Still getting the same error:

sh-3.2# ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/Library/Frameworks/Python.framework/Versions/2.7/bin/python --disable-framework
checking Apache version... 2.4.2
configure: creating ./config.status
config.status: creating Makefile
sh-3.2# make
make: Nothing to be done for `all'.
sh-3.2# make install
/usr/local/apache2/bin/apxs -i -S LIBEXECDIR=/usr/local/apache2/modules -n 'mod_wsgi' mod_wsgi.la
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/apr-1/build-1/libtool' mod_wsgi.la /usr/local/apache2/modules
/usr/share/apr-1/build-1/libtool --mode=install install mod_wsgi.la /usr/local/apache2/modules/
libtool: install: install .libs/mod_wsgi.so /usr/local/apache2/modules/mod_wsgi.so
libtool: install: install .libs/mod_wsgi.lai /usr/local/apache2/modules/mod_wsgi.la
libtool: install: install .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
ranlib: file: /usr/local/apache2/modules/mod_wsgi.a(wsgi_apache.o) has no symbols
libtool: install: warning: remember to run `libtool --finish /usr/libexec/apache2'
chmod 755 /usr/local/apache2/modules/mod_wsgi.so
sh-3.2# libtool --finish /usr/libexec/apache2
libtool: unknown option character `-' in: --finish
Usage: libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT]
Usage: libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
sh-3.2# otool -L /usr/local/apache2/modules/mod_wsgi.so 
/usr/local/apache2/modules/mod_wsgi.so:
/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.19.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
sh-3.2# /usr/local/apache2/bin/apachectl -t
httpd: Syntax error on line 149 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_wsgi.so into server: dlopen(/usr/local/apache2/modules/mod_wsgi.so, 10): Symbol not found: __Py_FalseStruct\n  Referenced from: /usr/local/apache2/modules/mod_wsgi.so\n  Expected in: flat namespace\n in /usr/local/apache2/modules/mod_wsgi.so


Unless you can spot obvious errors in the above, I think I will simplify my environment and reconfigure using the version of Apache that Apple ships this weekend.  Thank you for your time and input.

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

Graham Dumpleton

unread,
May 16, 2012, 9:04:53 PM5/16/12
to mod...@googlegroups.com
Make sure you do a:

make distclean

before running configure and rebuilding.

Graham
>> > modwsgi+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "modwsgi" group.
>> > To post to this group, send email to mod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > modwsgi+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "modwsgi" group.
>> > To post to this group, send email to mod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > modwsgi+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/HPXxLYzmVbkJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.

Abilard

unread,
May 17, 2012, 6:54:03 AM5/17/12
to mod...@googlegroups.com
Aye caramba!  That did it.  Excuse me while I go outside and scream.

Kevin
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "modwsgi" group.
>> > To post to this group, send email to mod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "modwsgi" group.
>> > To post to this group, send email to mod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/HPXxLYzmVbkJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
Reply all
Reply to author
Forward
0 new messages