make: *** [mod_wsgi.la] Error 1(solved)

1,414 views
Skip to first unread message

stuntgoat

unread,
Nov 30, 2007, 3:00:19 AM11/30/07
to modwsgi
I almost posted the message at the bottom but re-compiled Python using

<code>
$ ./configure --enable-shared
<code>
after making and installing I ran

# ldconfig

mod_wsgi and mod_python compiled fine.

Does ldconfig make the shared object for Python or tell another
program where it is?

-Isaac

------problem below has been
solved---------------------------------11/29/07

I have searched for specific information about how to resolve this
issue, compiled/installed python with --enable-shared and still I am
getting this when I make mod_wsgi:

<code>
/usr/local/apache2/bin/apxs -c -I/usr/local/include/python2.5 -
DNDEBUG mod_wsgi.c -L/usr/local/lib/python2.5/config -lpython2.5 -
lpthread -ldl -lutil
/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-
pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/
local/apache2/include -I/usr/local/apache2/include -I/usr/local/
apache2/include -I/usr/local/include/python2.5 -DNDEBUG -c -o
mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
/usr/local/apache2/build/libtool --silent --mode=link gcc -o
mod_wsgi.la -rpath /usr/local/apache2/modules -module -avoid-
version mod_wsgi.lo -L/usr/local/lib/python2.5/config -lpython2.5 -
lpthread -ldl -lutil
/usr/bin/ld: /usr/local/lib/python2.5/config/libpython2.5.a(node.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
.
make: *** [mod_wsgi.la] Error 1
</code>

2.6.23.1.111507b #1 SMP Thu Nov 15 21:30:58 PST 2007 x86_64 GNU/Linux
Debian Etch AMD64

according to your post here:
http://code.google.com/p/modwsgi/wiki/InstallationIssues

I have deduced that I do not have a shared library for my Python2.5
installation or cannot find it. I tried looking for libpython2.5.so.
1.0, what I believe the shared object file might be called.

# find / -iname 'libpython*'

returns no Python 2.5 shared object file that I can tell.

What .so file do I need to link to?
What do I need to call the link and where should I put it?
Should I post to comp.lang.python to get help making a Python .so file
I can use for mod_wsgi and mod_python?
-------------disregard-----------------------solved

Graham Dumpleton

unread,
Nov 30, 2007, 4:47:37 AM11/30/07
to mod...@googlegroups.com
Was running ldconfig actually necessary?

The shared library is built by the 'make' of Python. The 'ldconfig'
program is a system maintenance program generally only needed if you
want to add additional directories outside the normal library
directory search path such that programs can find them without having
to set LD_LIBRARY_PATH environment variable or having the directories
coded into program using LD_RUN_PATH environment variable at compile
time. If the Python library was installed in /usr/local/lib and that
was in the standard search path, 'ldconfig' shouldn't generally have
been required.

Graham

stuntgoat

unread,
Dec 1, 2007, 4:28:39 AM12/1/07
to modwsgi


On Nov 30, 9:47 am, "Graham Dumpleton" <graham.dumple...@gmail.com>
wrote:
> Was running ldconfig actually necessary?


Apparently running ldconfig was not the cause of my compilation
success. As a newbie, it seemed that after I compiled Python with --
enable-shared
I was unable to find the Python 2.5 .so file. I looked in /usr/local/
lib/python2.5/config/
and did not see a symlink to anything.

The only thing I can think of is that I was unable to make Python with
--enable-shared at first
and then I ran make correctly to create the .so file in /usr/local/
lib/.

FYI my version of Python was compiled for 64 bit(I compiled it on
AMD64) before I started trying to compile mod_wsgi. But I doubt --
enable-shared was given to ./configure.

Thank you for your correction and information.
Cheers

-Isaac
PS: I found this at the bottom of the man page for ldconfig:

BUGS
ldconfig, being a user process, must be run manually and has
no means of dynamically determining and relinking shared libraries for
use by ld.so when a new shared library is installed.

Is it possible that after Python's make built the shared library I
needed to manually run ldconfig to tell ld where to find my newly
created and installed shared object file?



>
> The shared library is built by the 'make' of Python. The 'ldconfig'
> program is a system maintenance program generally only needed if you
> want to add additional directories outside the normal library
> directory search path such that programs can find them without having
> to set LD_LIBRARY_PATH environment variable or having the directories
> coded into program using LD_RUN_PATH environment variable at compile
> time. If the Python library was installed in /usr/local/lib and that
> was in the standard search path, 'ldconfig' shouldn't generally have
> been required.
>
> Graham
>

Graham Dumpleton

unread,
Dec 1, 2007, 4:45:03 AM12/1/07
to mod...@googlegroups.com
On 01/12/2007, stuntgoat <hyper...@gmail.com> wrote:
>
>
>
> On Nov 30, 9:47 am, "Graham Dumpleton" <graham.dumple...@gmail.com>
> wrote:
> > Was running ldconfig actually necessary?
>
> Apparently running ldconfig was not the cause of my compilation
> success. As a newbie, it seemed that after I compiled Python with --
> enable-shared
> I was unable to find the Python 2.5 .so file. I looked in /usr/local/
> lib/python2.5/config/
> and did not see a symlink to anything.

That isn't your fault, the Python install target doesn't necessarily
create it. What it might do is put the .so in /usr/local/lib directory
only. What it should also do is create a symlink in the config
directory to it, but I don't think it does, it certainly doesn't in
older versions of Python.

This means that Linux distributions which provide Python often have to
add this symlink themselves. In other words, I believe it is a flaw of
the Python source code distribution. I don't know if it has been
addressed in more recent versions of Python source code.

Thus run:

cd /usr/local/lib/python2.5/config
ln -s ../../libpython2.5.so .

You need to create this symlink before you build mod_wsgi else
mod_wsgi will still use the static library. When the static library is
used it will sometimes work, but other times it causes problems.

> The only thing I can think of is that I was unable to make Python with
> --enable-shared at first
> and then I ran make correctly to create the .so file in /usr/local/
> lib/.
>
> FYI my version of Python was compiled for 64 bit(I compiled it on
> AMD64) before I started trying to compile mod_wsgi. But I doubt --
> enable-shared was given to ./configure.

If you run:

ldd mod_wsgi.so

on the resultant Apache mod_wsgi module, what does it output? You
should see a dependency on libpython2.5.so and it should pick it up
from /usr/local/lib.

> PS: I found this at the bottom of the man page for ldconfig:
>
> BUGS
> ldconfig, being a user process, must be run manually and has
> no means of dynamically determining and relinking shared libraries for
> use by ld.so when a new shared library is installed.
>
> Is it possible that after Python's make built the shared library I
> needed to manually run ldconfig to tell ld where to find my newly
> created and installed shared object file?

It may be possible, but generally that may mean having to edit its
config file in /etc to add /usr/local/lib if it isn't already listed,
or possibly listing /usr/local/lib as an argument to ldconfig.

Anyway, run ldd on mod_wsgi.so and we'll work out whether it is using
the shared library or not. Also send a listing of files in the config
directory. Ie.,

cd /usr/local/lib/python2.5/config
ls -las

Graham

so

stuntgoat

unread,
Dec 1, 2007, 6:51:03 AM12/1/07
to modwsgi
/usr/local/lib/python2.5/config$ ls -las

4 drwxr-sr-x 2 root staff 4096 2007-11-29 23:26 .
20 drwxr-sr-x 21 root staff 20480 2007-11-29 23:26 ..
4 -rw-r--r-- 1 root staff 2078 2007-11-29 23:26 config.c
4 -rw-r--r-- 1 root staff 1446 2007-11-29 23:26 config.c.in
8 -rwxr-xr-x 1 root staff 7122 2007-11-29 23:26 install-sh
7664 -rw-r--r-- 1 root staff 7833936 2007-11-29 23:26 libpython2.5.a
40 -rw-r--r-- 1 root staff 38327 2007-11-29 23:26 Makefile
8 -rwxr-xr-x 1 root staff 7430 2007-11-29 23:26 makesetup
8 -rw-r--r-- 1 root staff 6456 2007-11-29 23:26 python.o
20 -rw-r--r-- 1 root staff 17862 2007-11-29 23:26 Setup
4 -rw-r--r-- 1 root staff 368 2007-11-29 23:26 Setup.config
4 -rw-r--r-- 1 root staff 41 2007-11-29 23:26 Setup.local

/usr/local/apache2/modules$ ldd mod_wsgi.so
linux-vdso.so.1 => (0x00007fffd3dfe000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00002b29d7222000)
libdl.so.2 => /lib/libdl.so.2 (0x00002b29d743d000)
libutil.so.1 => /lib/libutil.so.1 (0x00002b29d7642000)
libc.so.6 => /lib/libc.so.6 (0x00002b29d7845000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

From Apache's error_log:
mod_python/3.3.1 Python/2.5.1 mod_wsgi/1.3 configured -- resuming
normal operations

my configure for mod_wsgi:
$ ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/
usr/local/bin/python

from mod_wsgi /config.log:
LDFLAGS='-L/usr/local/lib/python2.5/config'

I will set a link to the Python .so like you recommend and try and
recompile it. I'll let you know.

Thank you for your time.

-Isaac


On Dec 1, 9:45 am, "Graham Dumpleton" <graham.dumple...@gmail.com>
wrote:

stuntgoat

unread,
Dec 1, 2007, 3:09:04 PM12/1/07
to modwsgi

$ ldd /usr/local/apache2/modules/mod_wsgi.so
linux-vdso.so.1 => (0x00007fffeb3fe000)
libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0
(0x00002adebf94d000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00002adebfcba000)
libdl.so.2 => /lib/libdl.so.2 (0x00002adebfed6000)
libutil.so.1 => /lib/libutil.so.1 (0x00002adec00da000)
libc.so.6 => /lib/libc.so.6 (0x00002adec02dd000)
libm.so.6 => /lib/libm.so.6 (0x00002adec0635000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)

I would have missed that mod_wsgi.so was not compiled with the
Python shared library.

Thank you.

-Isaac

Graham Dumpleton

unread,
Dec 1, 2007, 4:02:04 PM12/1/07
to mod...@googlegroups.com
Thanks for verifying that. When I get a chance I'll try and make the
documentation a bit more prescriptive. I'll probably include your 'ls'
and 'ldd' output so it is more obvious to people.

Thanks.

Graham

Reply all
Reply to author
Forward
0 new messages