[mod_python] Compiling mod_python

Graham Dumpleton graham.dumpleton at gmail.com
Tue Mar 20 15:54:34 EST 2007


On 21/03/07, Roberto C. Sánchez <roberto at connexer.com> wrote:
> 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)

Then we can only assume then that OP compiled his Python from source
code as his doesn't use a shared library. Quoting his original email:

...
/config -Xlinker -export-dynamic -lm -lpython2.5 -lpthread -ldl -
lutil -lm
/usr/bin/ld: /usr/local/lib/python2.5/config/libpython2.5.a
(abstract.o): relocation R_X86_64_32 against `a local symbol' can not
be used when making a shared object; recompile with -fPIC
/usr/local/lib/python2.5/config/libpython2.5.a: could not read
symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536

As can be seen, trying to use libpython2.5.a. Therefore suggestion
still stands if for some reason he wants to continue to use version of
Python compiled from source code.

As far as debian binaries using --enable-shared that is good to hear.
If others can comment on whether binary distributions for other Linux
distributions use --enable-shared for Python build, would love to hear
so I know how common a practice it may or may not be across
distributions. If it is common, I can stop grumbling about it. ;-)

Thanks.

Graham



More information about the Mod_python mailing list