Skip to content

gh-90548: Fix musl version detection with --strip-all#137864

Merged
vstinner merged 3 commits intopython:mainfrom
cdce8p:musl-libc_ver
Sep 1, 2025
Merged

gh-90548: Fix musl version detection with --strip-all#137864
vstinner merged 3 commits intopython:mainfrom
cdce8p:musl-libc_ver

Conversation

@cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Aug 16, 2025

The change introduced in #131313 accidentally broke the musl version detection for test.support.linked_with_musl if cpython is compiled with --strip-all. In these cases the regex in platform.libc_ver should match the filename: libc.musl-x86_64.so.1.
https://pkgs.alpinelinux.org/contents?file=libc.*&path=&name=musl&branch=edge&repo=main&arch=

--strip-all is used among other things by the Alpine based Python docker image.
https://github.com/docker-library/python/blob/19c93d12094b07ecc21f67144a309c2fa0a10ef0/3.14-rc/alpine3.22/Dockerfile#L74

With this change:

./configure
make LDFLAGS="-Wl,--strip-all"

/usr/src # LD_LIBRARY_PATH=$PWD ./python.exe
Python 3.14.0rc2 (main, Aug 16 2025, 14:50:44) [GCC 14.2.0] on linux
>>> import test.support
>>> test.support.linked_to_musl()
(1,)

/usr/src # LD_LIBRARY_PATH=$PWD ./python.exe -m test.pythoninfo|grep libc
platform.libc_ver: musl 1

/CC @bitdancer

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants