Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

problems trying to build python 2.6 as a shared library

1,927 views
Skip to first unread message

Chris Withers

unread,
Sep 25, 2009, 7:08:05 AM9/25/09
to Python List
Hi All,

I'm trying to build Python 2.6 as a shared library, so I did:

./configure --enable-shared
make
make altinstall

No obvious signs of failure, but when I try and use the resulting
python, I get:

python2.6: error while loading shared libraries: libpython2.6.so.1.0:
cannot open shared object file: No such file or directory

Why might that be?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Marco Nawijn

unread,
Sep 25, 2009, 7:36:28 AM9/25/09
to

Hello Chris,

The dynamic loader cannot find the python shared library. There are
at least 2 options:
1. Add path that contains the shared library to the
LD_LIBRARY_PATH environment variable. In a bash shell this can be
accomplished by: export LD_LIBRARY_PATH=/path/to/python_shared_lib:
$LD_LIBRARY_PATH
2. Add path to dynamic linker configuration file. This typically
is in '/etc/ld.so.conf'. See man page for ld for more information.

Note that I assumed that you are on a Unix/Linux machine.

Regards,

Marco

Christian Heimes

unread,
Sep 25, 2009, 7:44:50 AM9/25/09
to pytho...@python.org
Marco Nawijn wrote:
> The dynamic loader cannot find the python shared library. There are
> at least 2 options:
> 1. Add path that contains the shared library to the
> LD_LIBRARY_PATH environment variable. In a bash shell this can be
> accomplished by: export LD_LIBRARY_PATH=/path/to/python_shared_lib:
> $LD_LIBRARY_PATH
> 2. Add path to dynamic linker configuration file. This typically
> is in '/etc/ld.so.conf'. See man page for ld for more information.


3. Set LD_RUN_PATH before you link the shared library or use the -rlink
option of the linker, see man(1) ld.

Christian

Chris Withers

unread,
Sep 30, 2009, 9:56:40 AM9/30/09
to Marco Nawijn, pytho...@python.org
Marco Nawijn wrote:
> 2. Add path to dynamic linker configuration file. This typically
> is in '/etc/ld.so.conf'. See man page for ld for more information.

Yes, this was it.
Don't forget to run ldconfig after you've changed /etc/ld.so.conf

It's frustrating how the contents of this file vary from distro to
distro, particularly w.r.t. /usr/local/lib :-(

scub...@gmail.com

unread,
Jan 19, 2013, 12:47:12 AM1/19/13
to
Could you elaborate on this for a Linux newbie please? I carried out step 1 with no problems, but when I view /etc/ld.so.conf, I get the following:

$ cat /etc/ld.so.conf
include ld.so.conf.d/*.conf

I don't know how to use ld - I see from the man pag that it's used for linking files, but I don't know (in this context) what files I want to be linking to what.

I've copied libpython2.7.so and libpython2.7.so.1.0 to the folder in $LD_LIBRARY_PATH, meaning I don't get the problems detailed in the original post anymore, but I'm concerned that I'm sticking a plaster over a bigger problem.
0 new messages