[mod_python] Compiling mod_python

Roberto C. Sánchez roberto at connexer.com
Tue Mar 20 11:19:24 EST 2007

On Tue, Mar 20, 2007 at 09:27:45PM +1100, Graham Dumpleton wrote:
> One reason for recompiling Python is because the prepackaged binary
> distributions of Python are generally never built with the
> --enabled-shared option. This means you only have a static libpython.a

This is not the case on Debian.  From a stock Sarge install:

ldd /usr/lib/apache2/modules/mod_python.so
	libpython2.3.so.1.0 => /usr/lib/libpython2.3.so.1.0 (0x4001b000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x40124000)
	libdl.so.2 => /lib/libdl.so.2 (0x40175000)
	libutil.so.1 => /lib/libutil.so.1 (0x40179000)
	libm.so.6 => /lib/libm.so.6 (0x4017c000)
	libc.so.6 => /lib/libc.so.6 (0x4019e000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

> file and on 64 bit platforms when recompiling mod_python like above
> this presents problems sometimes as Python packages are only built as
> 32 bit binaries. Also, that there is only a static libpython.a and not
> a libpython.so means that the static Python library has to be embedded
> within the mod_python.so file to work. This means that instead of your
> mod_python.so being in the order of a few hundred KBytes it is over
> 1MB in size. Because the Python library part of this is not
> relocatable object files, when it gets loaded into memory it
> potentially has to have address relocations done on it resulting in
> the mod_python.so no longer being shared between processes and instead
> each of your Apache child processes ends up with up to 1.5MB of extra
> private memory in use. In the end your Python web application is going
> to probably take a lot more memory than that but it doesn't make the
> situation any better.
> Thus, to the OP, rebuild your Python installation from source first
> and ensure that --enable-shared is used when configure is run. After
> you have that reinstalled, then try rebuilding mod_python and see if
> the error goes away. To save trashing the existing Python installation
> you might install new version of Python elsewhere. Be warned that you
> may have to ensure location of  'python' executable for new version is
> in PATH before standard one for user that Apache runs as. See how it
> goes without doing that first though. Not sure if rebuilding Apache is
> actually necessary.
Again, this is not necessary on Debian.



Roberto C. Sánchez
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070320/e083e3e3/attachment.bin

More information about the Mod_python mailing list