-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python <3.3.0 has problem compiling with --enable-shared #122
Comments
package distributors like https://packages.debian.org/en/sid/libpython3-dev , they don't consider python's patch version, or may not provide the newest library. I installed
so I installed |
Which distro are you using? Debian, Ubuntu? And which version? When compiling on Linux I use hygeia/src/commands/install/unix.rs Lines 151 to 155 in a19d299
It seems that if you have a shared library installed system wide it is picked up first. Can you try to call python directly using LD_LIBRARY_PATH=${HYGEIA_HOME}/installed/cpython/3.8.1/lib ${HYGEIA_HOME}/installed/cpython/3.8.1/bin/python -V If that works I'll try to think of something... |
I'm having trouble reproducing your problem. I'm using docker to get a debian sid ( hygeia@2d18f7390b85:~$ hygeia list
+--------+---------+---------------------+--------------------------------------------------+
| Active | Version | Installed by hygeia | Location |
+--------+---------+---------------------+--------------------------------------------------+
| | 3.7.6 | | /usr/bin |
+--------+---------+---------------------+--------------------------------------------------+
hygeia@2d18f7390b85:~$ /usr/bin/python3 -V
Python 3.7.6 The binary is not dynamically link to libpython: hygeia@2d18f7390b85:~$ ldd /usr/bin/python3
linux-vdso.so.1 (0x00007ffdb396a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6c46eee000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6c46ecd000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6c46ec8000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f6c46ec3000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f6c46e96000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6c46e79000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6c46d32000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6c470b4000)
hygeia@2d18f7390b85:~$ /usr/bin/python3 -m sysconfig -c 'print(sysconfig.get_config_vars())' | grep -i shared
BLDSHARED = "x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro"
CCSHARED = "-fPIC"
CFLAGSFORSHARED = "-fPIC"
CONFIG_ARGS = "'--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-loadable-sqlite-extensions' '--with-dbmliborder=bdb:gdbm' '--with-computed-gotos' '--without-ensurepip' '--with-system-expat' '--with-system-libmpdec' '--with-system-ffi' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-g -fstack-protector-strong -Wformat -Werror=format-security ' 'LDFLAGS= -Wl,-z,relro' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'"
COVERAGE_INFO = "/build/python3.7-9TOSzB/python3.7-3.7.6/build-shared/coverage.info"
COVERAGE_REPORT = "/build/python3.7-9TOSzB/python3.7-3.7.6/build-shared/lcov-report"
DESTSHARED = "/usr/lib/python3.7/lib-dynload"
INSTALL_SHARED = "/usr/bin/install -c -m 555"
LDCXXSHARED = "x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions"
LDSHARED = "x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro"
LINKFORSHARED = "-Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions"
Py_ENABLE_SHARED = "1"
RUNSHARED = "LD_LIBRARY_PATH=/build/python3.7-9TOSzB/python3.7-3.7.6/build-shared"
TESTPYTHON = "LD_LIBRARY_PATH=/build/python3.7-9TOSzB/python3.7-3.7.6/build-shared ./python"
TESTRUNNER = "LD_LIBRARY_PATH=/build/python3.7-9TOSzB/python3.7-3.7.6/build-shared ./python ../Tools/scripts/run_tests.py"
abs_builddir = "/build/python3.7-9TOSzB/python3.7-3.7.6/build-shared"
abs_srcdir = "/build/python3.7-9TOSzB/python3.7-3.7.6/build-shared/.." Installing 3.8.1 succeeds: hygeia@2d18f7390b85:~$ hygeia list
+--------+---------+---------------------+--------------------------------------------------+
| Active | Version | Installed by hygeia | Location |
+--------+---------+---------------------+--------------------------------------------------+
| | 3.8.1 | ✓ | /home/hygeia/.hygeia/installed/cpython/3.8.1/bin |
+--------+---------+---------------------+--------------------------------------------------+
| | 3.7.6 | | /usr/bin |
+--------+---------+---------------------+--------------------------------------------------+
hygeia@2d18f7390b85:~$ ldd /home/hygeia/.hygeia/installed/cpython/3.8.1/bin/python
linux-vdso.so.1 (0x00007ffcb74e1000)
libpython3.8.so.1.0 => /home/hygeia/.hygeia/installed/cpython/3.8.1/lib/libpython3.8.so.1.0 (0x00007fa2dda23000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa2dd85f000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa2dd83e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa2dd839000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fa2dd834000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa2dd6ef000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa2ddda7000)
hygeia@2d18f7390b85:~$ /home/hygeia/.hygeia/installed/cpython/3.8.1/bin/python -m sysconfig -c 'print(sysconfig.get_config_vars())' | grep -i shared
BLDSHARED = "gcc -pthread -shared"
CCSHARED = "-fPIC"
CFLAGSFORSHARED = "-fPIC"
CONFIG_ARGS = "'--prefix' '/home/hygeia/.hygeia/installed/cpython/3.8.1' '--enable-shared' 'CFLAGS=' 'LDFLAGS=' 'CPPFLAGS='"
DESTSHARED = "/home/hygeia/.hygeia/installed/cpython/3.8.1/lib/python3.8/lib-dynload"
INSTALL_SHARED = "/usr/bin/install -c -m 755"
LDCXXSHARED = "g++ -pthread -shared"
LDSHARED = "gcc -pthread -shared"
LINKFORSHARED = "-Xlinker -export-dynamic"
Py_ENABLE_SHARED = "1"
RUNSHARED = "LD_LIBRARY_PATH=/home/hygeia/.hygeia/cache/extracted/Python-3.8.1"
hygeia@2d18f7390b85:~$ /home/hygeia/.hygeia/installed/cpython/3.8.1/bin/python -V
Python 3.8.1 |
Running |
http://blog.dscpl.com.au/2015/06/installing-custom-python-version-into.html explains why distro provided python is statically linked but still include a shared lib; TL;DR the toolchain is compiled twice, once with |
There two issues here:
|
I've opened #139 to track the separate issue. |
If
--enable-shared
is used to compile Python <3.3.0, linking fails but is hard to see directly in pycors as it simply hangs:pstree
shows the calling hierarchy:Instead, running this manually exposes the linking problem (on macOS Catalina):
The text was updated successfully, but these errors were encountered: