From 145de2e2b993dd6a6b2501f9b7b55eed5384a00e Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 19 Mar 2025 20:40:07 -0500 Subject: [PATCH 1/4] Revert "Disable free-threaded builds" This reverts commit 70de8d8c944c9752900533a0967188418e2521b5. --- ci-targets.yaml | 52 ++++++++++++++++------------------- cpython-unix/build-cpython.sh | 2 +- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/ci-targets.yaml b/ci-targets.yaml index b1f53aa8..70078e87 100644 --- a/ci-targets.yaml +++ b/ci-targets.yaml @@ -264,13 +264,12 @@ linux: - 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" + build_options_conditional: + - options: + - freethreaded+debug + - freethreaded+noopt + - freethreaded+lto + minimum-python-version: "3.13" run: true x86_64_v2-unknown-linux-musl: @@ -291,13 +290,12 @@ linux: - 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" + build_options_conditional: + - options: + - freethreaded+debug + - freethreaded+noopt + - freethreaded+lto + minimum-python-version: "3.13" run: true x86_64_v3-unknown-linux-musl: @@ -318,13 +316,12 @@ linux: - 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" + build_options_conditional: + - options: + - freethreaded+debug + - freethreaded+noopt + - freethreaded+lto + minimum-python-version: "3.13" run: true x86_64_v4-unknown-linux-musl: @@ -345,13 +342,12 @@ linux: - 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" + build_options_conditional: + - options: + - freethreaded+debug + - freethreaded+noopt + - freethreaded+lto + minimum-python-version: "3.13" run: true windows: diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index bd045e91..0fb1310b 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -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. if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" && "${CC}" != "musl-clang" ]]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-mimalloc" fi From 17d66e1ebab9f21a9cf1bcd767e3abfca86f7cb1 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 19 Mar 2025 20:40:42 -0500 Subject: [PATCH 2/4] Enable mimalloc on musl builds --- cpython-unix/build-cpython.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 0fb1310b..dfd135ab 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -416,8 +416,8 @@ 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 [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" && "${CC}" != "musl-clang" ]]; then +# if it's missing from the system. +if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-mimalloc" fi From b38428b4043bd3bd8b88c917457ff0ed0796b779 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 20 Mar 2025 09:34:38 -0500 Subject: [PATCH 3/4] Include stdatomic.h from clang --- cpython-unix/build-cpython.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index dfd135ab..a83e43e8 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -401,6 +401,22 @@ if [ "${CC}" = "musl-clang" ]; then done fi +# To enable mimalloc (which is hard requirement for free-threaded versions, but preferred in +# general), we need `stdatomic.h` which is not provided by musl. It's are part of the include files +# that are part of clang. But musl-clang eliminates them from the default include path. So copy it +# into place. +if [[ "${CC}" = "musl-clang" && -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then + for h in /tools/${TOOLCHAIN}/lib/clang/*/include/stdatomic.h; do + filename=$(basename "$h") + if [ -e "/tools/host/include/${filename}" ]; then + echo "${filename} already exists; don't need to copy!" + exit 1 + fi + cp "$h" /tools/host/include/ + done +fi + + if [ -n "${CPYTHON_STATIC}" ]; then CFLAGS="${CFLAGS} -static" CPPFLAGS="${CPPFLAGS} -static" From d5ada5c7a626670d70bd1f39cc512500e6851cad Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 20 Mar 2025 17:08:30 -0500 Subject: [PATCH 4/4] Update cpython-unix/build-cpython.sh Co-authored-by: Aria Desires --- cpython-unix/build-cpython.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index a83e43e8..68d0bde2 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -402,7 +402,7 @@ if [ "${CC}" = "musl-clang" ]; then fi # To enable mimalloc (which is hard requirement for free-threaded versions, but preferred in -# general), we need `stdatomic.h` which is not provided by musl. It's are part of the include files +# general), we need `stdatomic.h` which is not provided by musl. It's a part of the include files # that are part of clang. But musl-clang eliminates them from the default include path. So copy it # into place. if [[ "${CC}" = "musl-clang" && -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then