Skip to content

Add support for Python 3.14 on musl #568

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

Merged
merged 7 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions ci-targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,21 @@ linux:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
build_options:
- debug+static
- noopt+static
- lto+static
- debug
- noopt
- lto
# freethreaded builds require mimalloc which is not available on musl yet
# build_options_conditional:
# - options:
# - freethreaded+debug
# - freethreaded+noopt
# - freethreaded+lto
# minimum-python-version: "3.13"
run: true

x86_64_v2-unknown-linux-musl:
Expand All @@ -275,13 +283,21 @@ linux:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
build_options:
- debug+static
- noopt+static
- lto+static
- debug
- noopt
- lto
# freethreaded builds require mimalloc which is not available on musl yet
# build_options_conditional:
# - options:
# - freethreaded+debug
# - freethreaded+noopt
# - freethreaded+lto
# minimum-python-version: "3.13"
run: true

x86_64_v3-unknown-linux-musl:
Expand All @@ -294,13 +310,21 @@ linux:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
build_options:
- debug+static
- noopt+static
- lto+static
- debug
- noopt
- lto
# freethreaded builds require mimalloc which is not available on musl yet
# build_options_conditional:
# - options:
# - freethreaded+debug
# - freethreaded+noopt
# - freethreaded+lto
# minimum-python-version: "3.13"
run: true

x86_64_v4-unknown-linux-musl:
Expand All @@ -313,13 +337,21 @@ linux:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
build_options:
- debug+static
- noopt+static
- lto+static
- debug
- noopt
- lto
# freethreaded builds require mimalloc which is not available on musl yet
# build_options_conditional:
# - options:
# - freethreaded+debug
# - freethreaded+noopt
# - freethreaded+lto
# minimum-python-version: "3.13"
Comment on lines +348 to +354
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels weird to add these in this PR but shrug

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were enabled initially then toggled off — I'd probably omit them if I hadn't fixed it in the next change.

run: true

windows:
Expand Down
6 changes: 3 additions & 3 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ if [ "${CC}" = "musl-clang" ]; then
# provided by musl. These are part of the include files that are part of clang.
# But musl-clang eliminates them from the default include path. So copy them into
# place.
for h in /tools/${TOOLCHAIN}/lib/clang/*/include/*intrin.h /tools/${TOOLCHAIN}/lib/clang/*/include/{__wmmintrin_aes.h,__wmmintrin_pclmul.h,mm_malloc.h}; do
for h in /tools/${TOOLCHAIN}/lib/clang/*/include/*intrin.h /tools/${TOOLCHAIN}/lib/clang/*/include/{__wmmintrin_aes.h,__wmmintrin_pclmul.h,mm_malloc.h,cpuid.h}; do
filename=$(basename "$h")
if [ -e "/tools/host/include/${filename}" ]; then
echo "${filename} already exists; don't need to copy!"
Expand All @@ -416,7 +416,7 @@ if [ -n "${CPYTHON_DEBUG}" ]; then
fi

# Explicitly enable mimalloc on 3.13+, it's already included by default but with this it'll fail
# if it's missing from the system. The MUSL builds do not supprt mimalloc yet.
# if it's missing from the system. The musl builds do not supprt mimalloc yet.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(funny this typo was retained — but this line is deleted in #571)

if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" && "${CC}" != "musl-clang" ]]; then
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-mimalloc"
fi
Expand Down Expand Up @@ -974,7 +974,7 @@ s390x-unknown-linux-gnu)
x86_64-unknown-linux-*)
# In Python 3.13+, the musl target is identified in cross compiles and the output directory
# is named accordingly.
if [ "${CC}" = "musl-clang" ] && [ "${PYTHON_MAJMIN_VERSION}" = "3.13" ]; then
if [[ "${CC}" = "musl-clang" && -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then
PYTHON_ARCH="x86_64-linux-musl"
else
PYTHON_ARCH="x86_64-linux-gnu"
Expand Down