[FIX] Support free-threaded Python cross-builds - #706
Open
iamthebot wants to merge 1 commit into
Open
Conversation
Separate host interpreter discovery from target development artifacts when cross-compiling. Select the free-threaded ABI for CMake 4.4+ and preserve scikit-build-core's target SOABI suffix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The conda-forge Python 3.14 free-threading migration is blocked for TVM FFI on platforms that rely on cross-compilation. Linux PPC64LE and macOS ARM64 builds fail during CMake's Python development lookup even though the target 3.14t headers are installed, while native 3.14t builds and GIL-enabled Python 3.14 cross-builds succeed.
This PR makes Python discovery distinguish the host interpreter used to run Cython from the target development artifacts used to build the extension. That lets downstream packagers build Python 3.14t wheels for those architectures without changing native builds or GIL-enabled cross-build behavior.
Background
Cross-compiling against Python 3.14t currently finds the host interpreter and detects
Py_GIL_DISABLED, but the secondFindPythoncall combines that host interpreter with targetDevelopment.Moduleartifacts. CMake 4.4 also enforces thegil_disabledABI default ofOFF,so it rejects the installed
python3.14ttarget headers and reportsmissing: Development.Module.The failing configurations are visible in
conda-forge/apache-tvm-ffi-feedstock#20:
Linux x86_64 to PPC64LE and macOS x86_64 to ARM64. Native Python 3.14t and cross-built GIL-enabled
Python 3.14 already pass.
This change keeps the first interpreter for free-thread detection and Cython, performs a
development-only target lookup when cross-compiling, and uses
SKBUILD_SOABIfor the targetextension suffix when available. Native discovery remains unchanged.
Fixes #705.
Testing
core.cpython-314t-powerpc64le-linux-gnu.socore.cpython-314t-darwin.socpython-314tsuffixpytest -n0 -vvs tests/python/test_free_threaded_python_helpers.py tests/python/test_build.py::test_build_cppcmake-format --check CMakeLists.txtcmake-lint CMakeLists.txtAI Disclosure
Was AI used in the creation of this PR?
The human identified the failing downstream migration, set the upstream issue and PR scope, and
made the key workflow decisions. OpenAI Codex (GPT-5), including delegated Codex agents,
investigated the CMake behavior, implemented the change, ran the native and cross-build validation
matrix, reviewed the final diff, and prepared this PR. The human reviewed and approved the final
diff; agent review did not replace that review.