[mod_python] RE: Mod_python Digest, Vol 48, Issue 23

Graham Dumpleton graham.dumpleton at gmail.com
Tue Mar 20 16:01:00 EST 2007


On 21/03/07, Posey, Jake E <Jake.E.Posey at boeing.com> wrote:
> I have the same problem with compiling mod_python on 64bit Red Hat with apache 2.2.4 and even after recompiling python 2.5 with --enable-shared everything configures, compiles, and install without any errors but when I run python -V I get the following error:
>
> [root at lcas204 ~]# /usr/local/bin/python -V
> /usr/local/bin/python: error while loading shared libraries: libpython2.5.so.1.0: cannot open shared object file: No such file or directory
> [root at lcas204 ~]#
>
> However the file does exist and it is in my path.
>
> [root at lcas204 lib]# pwd
> /usr/local/lib
> [root at lcas204 lib]# ls -ld *python*
> lrwxrwxrwx   1 root root      19 Mar 20 09:02 libpython2.5.so -> libpython2.5.so.1.0
> -r-xr-xr-x   1 root root 5001973 Mar 20 09:02 libpython2.5.so.1.0
> lrwxrwxrwx   1 root root      19 Mar 20 09:14 libpython.so -> libpython2.5.so.1.0
> drwxr-xr-x  21 root root   20480 Mar 20 09:02 python2.5
> [root at lcas204 lib]#
>
> [root at lcas204 ~]# echo $PATH
> /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/usr/local:/usr/local/lib:/usr/local/lib/python2.5
> [root at lcas204 ~]#
>
> But if I just run ./configure with no options it configure, compiles, and installs with no errors and I'm able to run python -V to check the version and make sure it is working but when I go to compile mod_python I'm back to the original problem.
>
> Any other ideas?

It isn't a Windows system. Only Windows system looks in PATH for DLLs
(shared libraries).

On Linux you have two choices. The first is to set the environment
variable LD_LIBRARY_PATH to list the names of any additional
directories that should be searched for shared libraries. The second,
and perhaps preferable one, is at the time of building Python in the
first place, set the environment variable LD_RUN_PATH to be the
directory where the library will eventually be installed.

The difference between the two is that LD_LIBRARY_PATH is only use at
runtime to find library, whereas value of LD_RUN_PATH is embedded
within the 'python' executable so the executable itself knows to look
in that directory. The latter eliminates the need to set any
environment variables at runtime.

Graham


More information about the Mod_python mailing list