problems trying to build python 2.6 as a shared library

C

Chris Withers

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
 
M

Marco Nawijn

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

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
 
C

Chris Withers

Marco said:
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 :-(

Chris
 
S

scubbojj

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

Could you elaborate on this for a Linux newbie please? I carried out step 1with 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top