Add configure --without-static-libpython to not build libpython3.10.a #87269
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
assignee = None closed_at = <Date 2021-02-17.10:58:14.481> created_at = <Date 2021-02-02.15:23:47.769> labels = ['build', '3.10'] title = 'Add configure --without-static-libpython to not build libpython3.10.a' updated_at = <Date 2021-03-01.07:04:12.058> user = 'https://github.com/vstinner'
activity = <Date 2021-03-01.07:04:12.058> actor = 'ned.deily' assignee = 'none' closed = True closed_date = <Date 2021-02-17.10:58:14.481> closer = 'vstinner' components = ['Build'] creation = <Date 2021-02-02.15:23:47.769> creator = 'vstinner' dependencies =  files =  hgrepos =  issue_num = 43103 keywords = ['patch'] message_count = 7.0 messages = ['386149', '386153', '386205', '386215', '386216', '387137', '387844'] nosy_count = 3.0 nosy_names = ['vstinner', 'ned.deily', 'pablogsal'] pr_nums = ['24418', '24676'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue43103' versions = ['Python 3.10']
The text was updated successfully, but these errors were encountered:
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
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.
"./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.