[mod_python] Trouble installing mod_python

Ron Reisor ron at UDel.Edu
Mon Dec 15 09:17:27 EST 2003


   The mod_python.so that is built doesn't depend on other needed shared
libraries.  This seems to be the result of how it is built by apxs.  I'm
not sure of the best way to get this problem resolved, but we have been
able to work around the problems. This is a little messy though:

   Build ssl and apache2.0.48 in /usr/local.  MacOSX 10.3 will use shared
libraries in /usr/local/lib without any changes.  The only thing I think
is special about the apache build is to specify --with-mpm=worker so you
get thread support

   Rebuild Python-2.3. I recommend 2.3.2 which includes some patches that
are important to us, but 2.3 works.  2.3.3c1 seems fine so far.  We
replaced the Apple supplied Python in preference for the latest version.
This replaces files in /Applications/MacPython-2.3 and
/Library/Frameworks/Python.framework and /usr/local/bin.  Build like:

./configure --enable-framework
make frameworkinstall

   To build mod_python, get the latest cvs.  It includes patches for
Python-2.3 memory/object allocation that will matter on MacOSX.  Build it
as usual to start:

./configure --with-apxs=/usr/local/bin/apxs
make install

   But, the apxs will use the gnu libtool and what you end up with is a
mod_python.so that doesn't have the right dependencies.  You can check
this with otool:

[roaming-163-213:~/macpython/httpd-python] ron% otool -L
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 71.0.0)
[roaming-163-213:~/macpython/httpd-python] ron%

   Key libraries, like Python, are missing.  So, here's the really messy
part.  Remove the mod_python.so link from src and run this command in the
src directory:

libtool -o mod_python.so -dynamic -flat_namespace -undefined suppress
hlistobject.o hlist.o filterobject.o connobject.o serverobject.o util.o
tableobject.o requestobject.o _apachemodule.o mod_python.o -framework
System -lcc_dynamic -arch_only ppc -framework Python -framework
CoreServices -framework Foundation -lm

   That should be all one shell command line.  One important difference
here is that the libtool you use is the Apple supplied libtool, not the
gnu libtool that apxs would normally use.  Also, there's switches in there
that I don't know how to get apxs to generate. If you check this with
otool you should see:

[roaming-163-213:~/macpython/httpd-python/src] ron% otool -L mod_python.so
        mod_python.so (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 71.0.0)
(compatibility version 2.3.0, current version 2.3.0)

(compatibility version 1.0.0, current version 16.0.0)

(compatibility version 300.0.0, current version 500.5.0)
[roaming-163-213:~/macpython/httpd-python/src] ron%

   Then, copy the mod_python.so into the /usr/local/modules directory.



On Fri, 12 Dec 2003, Kevin Ballard wrote:

> I'm running Mac OS X 10.3 with Apache 2 installed (via the Complete
> Apache 2 installer package) and I'm trying to install mod_python
> (latest from CVS). I ./configure and make and make install it fine, but
> when I add the LoadModule line to my httpd.conf file and do a Check
> Syntax I get the following error:
> Syntax error on line 1099 of /Library/Apache2/conf/httpd.conf:
> Cannot load /Library/Apache2/modules/mod_python.so into server: dyld:
> /Library/Apache2/bin/httpd Undefined symbols:
> _PyExc_AttributeError
> _PyExc_IOError
> _PyExc_IndexError
> _PyExc_KeyError
> _PyExc_RuntimeError
> _PyExc_StopIteration
> _PyExc_TypeError
> _PyExc_ValueError
> _PyInt_Type
> _PyList_Type
> _PyObject_GenericGetAttr
> _PyObject_GenericSetAttr
> _PyString_Type
> _PyType_Type
> _Py_OptimizeFlag
> __Py_NoneStruct
> __Py_NotImplementedStruct
> line 1099 is my LoadModule for mod_python. Why am I getting this error
> and how can I fix it?
> --
> Kevin Ballard
> kevin at sb.org
> http://www.tildesoft.com
> http://kevin.sb.org
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

Ron Reisor <ron at udel.edu> (RWR3)
University of Delaware Information Technologies/Network and Systems Services
Computing Center/192 South Chapel Street/Newark DE, 19716
pgp finger print: 0D 73 06 6F D3 6A 99 D3  F5 D5 6E FF 3B B9 7C 2C

More information about the Mod_python mailing list