-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Add configure --without-static-libpython to not build libpython3.10.a #87269
Comments
Currently, "make install" copies Programs/python.o to $prefix/lib/python3.10/config-3.10-x86_64-linux-gnu/: see bpo-42307. This file is only useful to build a static Python executable with libpython3.10.a. libpython3.10.a is also copied to $prefix/lib/python3.10/config-3.10-x86_64-linux-gnu/. Most users don't build a static Python executable, so I propose to no longer build "static Python" by default and add --with-static-python option to the configure script. --- Fedora has a downstream patch to not build libpythonX.Y.a for 11 years: It is needed to respect the Fedora packaging guideline. The patch was introduced in Fedora to fix "python : does not adhere to Static Library Packaging Guideline" issue: """ The package is in need of an update because it does not adhere to http://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Static_Libraries The -devel package contains both the shared and the static build of Correct would be to either disable/delete the static libraries at Please consult the guidelines for the details. [...] python-devel |
"./configure --enable-shared --prefix /opt/py310 && make && make install" installs multiple files which are only useful to create a static Python binary: $ ls /opt/py310/lib/python3.10/config-3.10-x86_64-linux-gnu/ -1
config.c
config.c.in
install-sh*
libpython3.10.a
Makefile
makesetup*
__pycache__/
python-config.py*
python.o
Setup
Setup.local
$ ls /opt/py310/lib/ -1
libpython3.10.so@
libpython3.10.so.1.0*
libpython3.so*
pkgconfig/
python3.10/ libpython3.10.a is a big file: 15 MB. Without --enable-shared, /opt/py310/lib/ contains a second copy of libpython3.10.a! Example with the Ubuntu libpython3.6-dev package: $ dpkg -L libpython3.6-dev|grep config-
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/Makefile
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/Setup
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/Setup.config
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/Setup.local
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/config.c
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/config.c.in
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/install-sh
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m-pic.a
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.a
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/makesetup
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/python-config.py
/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/python.o By the way, it seems like many files of /opt/py310/lib/python3.10/config-3.10-x86_64-linux-gnu/ are useless. The most useful one is python-config.py script. Makefile is no longer used by sysconfig which creates _sysconfigdata__linux_x86_64-linux-gnu.py (in /opt/py310/lib/python3.10/) instead. |
About the option name, I consider to rename it to: --with-static-libpython, since technically it doesn't build a static "python" executable, but a static "libpython" (.a). |
There are some build systems and downstream distributors that expect the .a to be there, so I propose to at least not changing the default. |
I rewrote my PR to leave the default behavior unchanged and I renamed the option to --without-static-libpython (python => libpython). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: