compilation - Problems installing Python 3 with --enable-shared -
problem
i'm trying install python 3 --enable-shared option. installation "succeeds" resulting python not runnable. trying run python after installation gives following error:
$ /opt/python3/bin/python3.5 /opt/python3/bin/python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: no such file or directory
background
the os debian (squeeze), , has previous installation of python 2.6, necessary retain because other code relies on it, , apache 2.2. i'm trying set django run on apache, meaning i'm trying install mod_wsgi (or mod_wsgi-express), requires shared libraries. have tried install mod_wsgi without using --enable-shared
in python installation, , have gotten... well, same thing, time mod_wsgi installer (and pip install mod_wsgi
, tried): /opt/python3/bin/python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: no such file or directory
.
trace
starting installation described in background above, here minimum list of commands i've executed produce error above (with verbosity removed).
user@server:~$ wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.tgz user@server:~$ tar -zxvf python-3.5.1.tgz user@server:~$ cd python-3.5.1 user@server:~/python-3.5.1$ ./configure --prefix=/opt/python3 --enable-shared user@server:~/python-3.5.1$ make && sudo make install (... appears install correctly) user@server:~/python-3.5.1$ /opt/python3/bin/python3.5 /opt/python3/bin/python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: no such file or directory
i have tried ld_run_path
set described in solution other question, same results:
user@server:~/python-3.5.1$ sudo make distclean user@server:~/python-3.5.1$ ./configure --prefix=/opt/python3 --enable-shared user@server:~/python-3.5.1$ ld_run_path=/usr/local/lib make user@server:~/python-3.5.1$ sudo make install user@server:~/python-3.5.1$ /opt/python3/bin/python3.5 /opt/python3/bin/python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: no such file or directory
i have tried python 3.4, same results. have not tried python 2, because not want future development limited python 2.7 (therefore successful installation not satisfy requirements). i'm assuming attempt not provide new or useful information.
other observations
i've noticed python3.5
folder not appear in /usr/local/lib
when installing python --enable-shared
, appear if --enable-shared
not used. i'm assuming natural consequence of --enable-shared
. python2.6
folder there, expected. (could new shared installation trying use python2.6
libraries? or existence of 2.6 folder interfering in other ways?)
final thoughts
i'm software programmer forced play role of sys admin, first guess there's little (obscure? well-known?) detail i'm not understanding how installations work on linux, or how python libraries interact on operating system level. i've sunk lot of time narrowing problem down python installation, , trying find solution. (so if solution exists online, please gentle , understand did look!)
i'm guessing related this unanswered question?
may related extensions or build environments?
i've repeated steps on centos7 , similar:
$ /tmp/py3/bin/python3 /tmp/py3/bin/python3: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: no such file or directory
if @ linking of python, isn't providing full path library:
$ ldd /tmp/py3/bin/python3 linux-vdso.so.1 => (0x00007fff47ba5000) libpython3.5m.so.1.0 => not found libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdfaa32e000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fdfaa12a000) libutil.so.1 => /lib64/libutil.so.1 (0x00007fdfa9f27000) libm.so.6 => /lib64/libm.so.6 (0x00007fdfa9c24000) libc.so.6 => /lib64/libc.so.6 (0x00007fdfa9862000) /lib64/ld-linux-x86-64.so.2 (0x000055e85eac5000)
for reason, python build process isn't adding -rpath
link line, "add directory runtime library search path."
if explicitly set library path, work:
$ ld_library_path=/tmp/py3/lib/ /tmp/py3/bin/python3 python 3.5.1 (default, jun 10 2016, 14:54:59) [gcc 4.8.5 20150623 (red hat 4.8.5-4)] on linux type "help", "copyright", "credits" or "license" more information. >>>
so becomes question whether want to:
- set
ld_library_path
globally on system - edit
/etc/ld.so.conf
(or/etc/ld.so.conf.d/*
) - use
chrpath
change embedded path export ld_run_path={prefix}/lib
before runconfigure
,make
(where{prefix}
passed--prefix
. used wrong path.)
Comments
Post a Comment