Repository navigation
feat(toolchains): support debug runtimes on Linux and macOS - #4471
Conversation
python-build-standalone debug (Py_DEBUG) archives add a "d" ABI flag to the include dir and libpython names (include/python3.14d, libpython3.14d.so), which the runtime repo did not know. The repo rule now checks the extracted archive for the "d" include dir. The runtime macro then uses the "d" names and sets abi_flags to "d" or "td". Windows is unchanged. Also registers a debug runtime for tests and adds //tests/toolchains:debug_runtime_test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
I prepared this with Claude Code. It wrote the change and the test, built against the python-build-standalone 3.14 debug and free-threaded debug archives on Linux x86_64, and ran the new test there. macOS is checked only against the archive layout ( |
| # NOTE: 3.14.10, the newest 3.14, would break //tests/toolchains:build_test. | ||
| dev_python.single_version_platform_override( | ||
| platform = "linux-x86-debug", | ||
| python_version = "3.14.4", |
There was a problem hiding this comment.
Raised #4472 for this. 3.14.4 is the highest other than 3.14.10 in the runtimes manifest.
|
What about adding an additional flag to the matching algorith so that if users would like to not use the or use them exclusively, they can do that? Do these runtimes provide something that would be of interest to the users? |
I'm +1 on being able to set a flag so that a debug runtime can be chosen, but lets defer that to another PR. There's like 3 different ways we could have it specified:
...but we can figure that out separately. This PR will at least make them usable.
I think its mostly of interest to people writing C extensions, e.g. helping debug why an extension is misusing memory. |
rickeylev
left a comment
There was a problem hiding this comment.
LGTM. Github has been queueing jobs for hours, so no idea when this will actually end up in the merge queue.
Follow-up to #4442.
python-build-standalone debug (
Py_DEBUG) archives for Linux and macOSadd a
dABI flag to some names:include/python3.14dandlib/libpython3.14d.so(.dylibon macOS), ortdfor free-threadeddebug builds. The runtime repo only knows the release names, so a debug
runtime registered with
python.single_version_platform_overridedoesnot work for C code:
current_py_cc_headersfails withPython.h: No such file or directoryandcurrent_py_cc_libswithmissing input file '...//:lib/libpython3.14.so'. On a macOS host, therepo rule's
install_name_toolstep also looks for the release dylib.To fix, the repo rule checks the extracted archive for the
dincludedir and passes that to the runtime macro, which uses the
dnames. Themacro also sets
abi_flagsonpy_runtimeandpy_cc_toolchain,because
<AUTO>only derivest. Extensions built against the debugheaders need a debug interpreter, so they get the debug SOABI (for
example
cpython-314d-x86_64-linux-gnu) and wheel ABI tag (cp314d).Windows debug archives use other names (
python_d.exe,python314_d.dll) and are not handled here. Will be addressedseparately.
MODULE.bazeland adds//tests/toolchains:debug_runtime_test, which builds an extensionagainst it and imports it.