ramkrishanbhatt / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

_PyExc_RuntimeError with macports' python against OSX 10.5.8's apache #155

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Here's my problem:

$ sudo apachectl configtest
httpd: Syntax error on line 160 of /private/etc/apache2/httpd.conf: Cannot
load /usr/libexec/apache2/mod_wsgi.so into server:
dlopen(/usr/libexec/apache2/mod_wsgi.so, 10): Symbol not found:
_PyExc_RuntimeError\n  Referenced from: /usr/libexec/apache2/mod_wsgi.so\n
 Expected in: dynamic lookup\n

Any help is greatly appreciated.

http://sites.google.com/a/nicerobot.org/builds/home/mod_wsgi-macports_python-osx
_apache

##
## Here are my build steps:
## Note: I had the same problem with mod_wsgi 2.5.
##
##

$ curl http://modwsgi.googlecode.com/files/mod_wsgi-3.0c4.tar.gz | tar zx
$ cd mod_wsgi-3.0c4

$ ./configure
checking for apxs2... no
checking for apxs... /usr/sbin/apxs
checking Apache version... 2.2.11
checking for python... /opt/local/bin/python
configure: creating ./config.status
config.status: creating Makefile

# Note: I tried with and without this edit to Makefile:
#   LDFLAGS = -W1,-F/opt/local/Library/Frameworks ...

$ make
/usr/sbin/apxs -c
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
-DNDEBUG  -Wc,'-arch ppc7400' -Wc,'-arch ppc64' -Wc,'-arch i386' -Wc,'-arch
x86_64' mod_wsgi.c -W1,-F/opt/local/Library/Frameworks
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/conf
ig
 -arch ppc7400 -arch ppc64 -arch i386 -arch x86_64 -lpython2.6 -ldl 
/usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
-DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2 
-I/usr/include/apr-1   -I/usr/include/apr-1  -arch ppc7400 -arch ppc64
-arch i386 -arch x86_64
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
-DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
/usr/share/apr-1/build-1/libtool --silent --mode=link gcc -o mod_wsgi.la 
-rpath /usr/libexec/apache2 -module -avoid-version    mod_wsgi.lo
-W1,-F/opt/local/Library/Frameworks
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/conf
ig
-arch ppc7400 -arch ppc64 -arch i386 -arch x86_64 -lpython2.6 -ldl

$ sudo make install
/usr/sbin/apxs -i -S LIBEXECDIR=/usr/libexec/apache2 -n 'mod_wsgi' mod_wsgi.la
/usr/share/httpd/build/instdso.sh
SH_LIBTOOL='/usr/share/apr-1/build-1/libtool' mod_wsgi.la /usr/libexec/apache2
/usr/share/apr-1/build-1/libtool --mode=install cp mod_wsgi.la
/usr/libexec/apache2/
cp .libs/mod_wsgi.so /usr/libexec/apache2/mod_wsgi.so
cp .libs/mod_wsgi.lai /usr/libexec/apache2/mod_wsgi.la
cp .libs/mod_wsgi.a /usr/libexec/apache2/mod_wsgi.a
ranlib /usr/libexec/apache2/mod_wsgi.a
chmod 644 /usr/libexec/apache2/mod_wsgi.a
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/libexec/apache2

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/libexec/apache2/mod_wsgi.so

##
## Here are some file details:
##
##

$ file /usr/libexec/apache2/mod_wsgi.so 
/usr/libexec/apache2/mod_wsgi.so: Mach-O universal binary with 4 architectures
/usr/libexec/apache2/mod_wsgi.so (for architecture ppc7400):    Mach-O
bundle ppc
/usr/libexec/apache2/mod_wsgi.so (for architecture ppc64):      Mach-O
64-bit bundle ppc64
/usr/libexec/apache2/mod_wsgi.so (for architecture i386):       Mach-O
bundle i386
/usr/libexec/apache2/mod_wsgi.so (for architecture x86_64):     Mach-O
64-bit bundle x86_64

$ file /usr/sbin/httpd    
/usr/sbin/httpd: Mach-O universal binary with 4 architectures
/usr/sbin/httpd (for architecture ppc7400):     Mach-O executable ppc
/usr/sbin/httpd (for architecture ppc64):       Mach-O 64-bit executable ppc64
/usr/sbin/httpd (for architecture i386):        Mach-O executable i386
/usr/sbin/httpd (for architecture x86_64):      Mach-O 64-bit executable x86_64

$ file
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6:
Mach-O executable i386

$ file /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python 
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python: Mach-O
universal binary with 4 architectures
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python (for
architecture i386):     Mach-O dynamically linked shared library i386
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python (for
architecture ppc):      Mach-O dynamically linked shared library ppc
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python (for
architecture ppc64):    Mach-O 64-bit dynamically linked shared library ppc64
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python (for
architecture x86_64):   Mach-O 64-bit dynamically linked shared library x86_64

$ otool -L /usr/libexec/apache2/mod_wsgi.so 
/usr/libexec/apache2/mod_wsgi.so:
        /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python
(compatibility version 2.6.0, current version 2.6.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 111.1.4)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)

$ sudo python-config --ldflags
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/conf
ig
-ldl -lpython2.6

Original issue reported on code.google.com by nicero...@gmail.com on 9 Sep 2009 at 3:45

GoogleCodeExporter commented 8 years ago
It is meant to be:

  -Wl,-F/opt/local/Library/Frameworks

you had '1' instead 'l'. Ie., use ell, not one.

Better still again, download:

  http://modwsgi.googlecode.com/svn/branches/mod_wsgi-2.X/configure

and replace one in source with that. Then rerun configure.

The changes in that configure script are detailed in:

  http://code.google.com/p/modwsgi/wiki/ChangesInVersion0206

MacPorts is a bit of a pain and how to link with it so don't have problems 
seems to vary between builds and OS 
versions. Those changes in configure script were latest attempt at solution, 
but even that is possibly not working on 
Snow Leopard.

Original comment by Graham.Dumpleton@gmail.com on 9 Sep 2009 at 6:41

GoogleCodeExporter commented 8 years ago
Thanks. I thought i copy/pasted the LDFLAGS line. At any rate, i copy/pasted 
this
time and it still produced the same error. And i did already try that configure.
So now i've tried 2.5, 2.X and 3.0 and i think every combination of those with 
and
without Makefile edits. All produce the same results.
Any more thoughts?

Original comment by nicero...@gmail.com on 10 Sep 2009 at 12:45

GoogleCodeExporter commented 8 years ago
Are you loading mod_python into same Apache instance?

Original comment by Graham.Dumpleton@gmail.com on 10 Sep 2009 at 12:48

GoogleCodeExporter commented 8 years ago
Nope. No mod_python.

Original comment by nicero...@gmail.com on 10 Sep 2009 at 3:01

GoogleCodeExporter commented 8 years ago
When you go:

  which gcc

what does it use? Does it use /usr/bin/gcc, or MacPorts gcc?

Is there a specific read why you can't use Python 2.5 that ships with Apple?

Would you be prepared to build Python 2 6. from PSF source code rather than use 
MacPorts? The MacPorts 
packages seem to give no end of trouble when trying to embed their Python into 
other applications.

Original comment by Graham.Dumpleton@gmail.com on 10 Sep 2009 at 5:30

GoogleCodeExporter commented 8 years ago
$ which gcc
/usr/bin/gcc

I don't remember why i can't use 2.5 but i ran into some issues with it which 
was why
i installed MacPorts' version in the first place. I've had nothing but trouble 
with
MacPorts when it comes to doing anything no strictly within their domain, which 
seems
to be their philosophy so i won't complain too much :)

I'll try using my own build of Python instead of MacPorts. I probably would 
have been
up and running already if i wasn't so focused on solving this problem :-|

Thanks for the help. 

Original comment by nicero...@gmail.com on 11 Sep 2009 at 4:05

GoogleCodeExporter commented 8 years ago
After removing all traces of Python from MacPorts, i.e. reverting to OSX's 
python2.5,
mod_wsgi worked perfectly.
Thanks

Original comment by nicero...@gmail.com on 11 Sep 2009 at 1:08

GoogleCodeExporter commented 8 years ago
Yet another issue caused by MacPorts Python. Closing issue as can't see that 
anything needs to be done beyond 
more flexibility in configure options for controlling framework linking that 
has already been added.

Original comment by Graham.Dumpleton@gmail.com on 18 Nov 2009 at 6:40