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

Add support for Python 3.14 on musl #568

merged 7 commits into from
Mar 20, 2025

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Mar 19, 2025

Closes #558
Follow-up to #443

@zanieb
Copy link
Member Author

zanieb commented Mar 19, 2025

Failing with

cpython-3.14> ./Modules/blake2module.c:37:10
cpython-3.14> : fatal error: 'cpuid.h' file not found
cpython-3.14> #include <cpuid.h>
cpython-3.14>          ^~~~~~~~~
cpython-3.14> 1 error generated.
cpython-3.14> Makefile:3344: recipe for target 'Modules/blake2module.o' failed
cpython-3.14> make: *** [Modules/blake2module.o] Error 1

resolved in 6c2a3b2

@zanieb zanieb added the platform:linux Specific to the Linux platform label Mar 19, 2025
@zanieb
Copy link
Member Author

zanieb commented Mar 19, 2025

2025-03-19T23:13:19.1109415Z cpython-3.14> error:
2025-03-19T23:13:19.1109863Z cpython-3.14> implicit declaration of function '__cpuid_count' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
2025-03-19T23:13:19.1110394Z cpython-3.14>     __cpuid_count(1, 0, eax1, ebx1, ecx1, edx1);
2025-03-19T23:13:19.1110706Z cpython-3.14>     ^
2025-03-19T23:13:19.1444788Z cpython-3.14> 1 error generated.
2025-03-19T23:13:19.1456676Z cpython-3.14> Makefile:3344: recipe for target 'Modules/blake2module.o' failed

resolved in 5ba95ac

@zanieb
Copy link
Member Author

zanieb commented Mar 19, 2025

2025-03-19T23:41:27.5140604Z cpython-3.14> copying /tmp/tmpywk2oxni to container:/build/out/python/PYTHON.json
2025-03-19T23:41:29.1906475Z Traceback (most recent call last):
2025-03-19T23:41:29.1999975Z   File "/home/runner/work/python-build-standalone/python-build-standalone/cpython-unix/build.py", line 1294, in <module>
2025-03-19T23:41:29.2000940Z     sys.exit(main())
2025-03-19T23:41:29.2001159Z              ^^^^^^
2025-03-19T23:41:29.2001637Z   File "/home/runner/work/python-build-standalone/python-build-standalone/cpython-unix/build.py", line 1276, in main
2025-03-19T23:41:29.2002107Z     build_cpython(
2025-03-19T23:41:29.2002603Z   File "/home/runner/work/python-build-standalone/python-build-standalone/cpython-unix/build.py", line 964, in build_cpython
2025-03-19T23:41:29.2003138Z     fh.write(build_env.get_output_archive("python"))
2025-03-19T23:41:29.2003416Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-19T23:41:29.2004069Z   File "/home/runner/work/python-build-standalone/python-build-standalone/pythonbuild/buildenv.py", line 125, in get_output_archive
2025-03-19T23:41:29.2004575Z     data = normalize_tar_archive(data)
2025-03-19T23:41:29.2004840Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-19T23:41:29.2005465Z   File "/home/runner/work/python-build-standalone/python-build-standalone/pythonbuild/utils.py", line 377, in normalize_tar_archive
2025-03-19T23:41:29.2005976Z     filedata = tf.extractfile(ti)
2025-03-19T23:41:29.2006223Z                ^^^^^^^^^^^^^^^^^^
2025-03-19T23:41:29.2006628Z   File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/tarfile.py", line 2410, in extractfile
2025-03-19T23:41:29.2007081Z     return self.extractfile(self._find_link_target(tarinfo))
2025-03-19T23:41:29.2007392Z                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-19T23:41:29.2007824Z   File "/opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/tarfile.py", line 2752, in _find_link_target
2025-03-19T23:41:29.2008287Z     raise KeyError("linkname %r not found" % linkname)
2025-03-19T23:41:29.2008729Z KeyError: "linkname 'python/install/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14.a' not found"
2025-03-19T23:41:29.2396369Z make: *** [Makefile:303: /home/runner/work/python-build-standalone/python-build-standalone/build/cpython-3.14.0a6-x86_64_v4-unknown-linux-musl-noopt.tar] Error 1

resolved by 445dc69

@zanieb
Copy link
Member Author

zanieb commented Mar 19, 2025

As a note, I'm not sure if cpuid should be available or not — I'll follow-up on that after and open an upstream patch if needed.

@zanieb
Copy link
Member Author

zanieb commented Mar 20, 2025

Now, just the freethreaded builds are failing

2025-03-20T00:05:09.4982722Z cpython-3.14> checking for --with-mimalloc...
2025-03-20T00:05:09.4983980Z cpython-3.14> configure: error: --disable-gil requires mimalloc memory allocator (--with-mimalloc).
2025-03-20T00:05:10.3107572Z Traceback (most recent call last):
2025-03-20T00:05:10.3226926Z   File "/home/runner/work/python-build-standalone/python-build-standalone/cpython-unix/build.py", line 1294, in <module>
2025-03-20T00:05:10.3227906Z     sys.exit(main())
2025-03-20T00:05:10.3230229Z              ^^^^^^
2025-03-20T00:05:10.3230721Z   File "/home/runner/work/python-build-standalone/python-build-standalone/cpython-unix/build.py", line 1276, in main
2025-03-20T00:05:10.3231483Z     build_cpython(
2025-03-20T00:05:10.3231961Z   File "/home/runner/work/python-build-standalone/python-build-standalone/cpython-unix/build.py", line 852, in build_cpython
2025-03-20T00:05:10.3232611Z     build_env.run("build-cpython.sh", environment=env)
2025-03-20T00:05:10.3233143Z   File "/home/runner/work/python-build-standalone/python-build-standalone/pythonbuild/buildenv.py", line 98, in run
2025-03-20T00:05:10.3233703Z     container_exec(self.container, program, user=user, environment=environment)
2025-03-20T00:05:10.3234322Z   File "/home/runner/work/python-build-standalone/python-build-standalone/pythonbuild/docker.py", line 143, in container_exec
2025-03-20T00:05:10.3234928Z     raise Exception("exit code %d from %s" % (inspect_res["ExitCode"], command))
2025-03-20T00:05:10.3235304Z Exception: exit code 1 from /build/build-cpython.sh
2025-03-20T00:05:10.3453967Z make: *** [Makefile:303: /home/runner/work/python-build-standalone/python-build-standalone/build/cpython-3.14.0a6-x86_64-unknown-linux-musl-freethreaded+noopt.tar] Error 1

Moving that into #571

@zanieb zanieb marked this pull request as ready for review March 20, 2025 01:55
@zanieb zanieb requested a review from geofft March 20, 2025 13:27
@zanieb
Copy link
Member Author

zanieb commented Mar 20, 2025

Ah I wonder if cpuid is the same as stdatomic?

@zanieb
Copy link
Member Author

zanieb commented Mar 20, 2025

Indeed! Well that's better.

@@ -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)

Comment on lines +348 to +354
# 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"
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.

@zanieb zanieb merged commit a870b62 into main Mar 20, 2025
40 checks passed
@zanieb zanieb deleted the zb/musl-314 branch March 20, 2025 22:09
zanieb added a commit that referenced this pull request Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc:musl platform:linux Specific to the Linux platform python:3.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add python 3.14 musl distributions
2 participants