You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
prelude/rust: from_any_dir.py needs Python ≥ 3.12 (Path.relative_to(walk_up=True)) but the bootstrap toolchain runs whatever host python3 is #1490
prelude/rust/tools/from_any_dir.py (the CC/CXX/LD/AR shim used by cargo_buildscript) calls Path.relative_to(..., walk_up=True), which only exists on Python ≥ 3.12. Nothing in the prelude declares or checks that minimum: system_python_bootstrap_toolchain() runs the shim with whatever bare python3 the host provides. On macOS the Command Line Tools still ship /usr/bin/python3 = 3.9.6 (verified on macOS 26.6.2), so every Rust build script that compiles C through the shim fails on a stock Mac.
Where
prelude/rust/tools/from_any_dir.py line 40 (unchanged between the 2026-08-22 tag and main as of 2026-09-04):
prelude/toolchains/python.bzl: system_python_bootstrap_toolchain defaults the interpreter to the bare name python3 (_interpreter_for_os), so the shim runs under the host's default Python.
prelude/rust/cargo_buildscript.bzl_make_cc_shim: wraps CC/CXX/LD/AR in the shim for every buildscript_run.
Reproduce
A host whose default python3 is < 3.12 (e.g. macOS with only the Command Line Tools: /usr/bin/python3 --version → Python 3.9.6).
Default toolchains: system_python_bootstrap_toolchain() and system_cxx_toolchain().
Any Rust crate whose build.rs compiles C via the cc crate, run as a cargo_buildscript (e.g. Reindeer-generated libsqlite3-sys 0.38.2 with buildscript.run = true, bundled feature).
Result: the build script's first cc invocation goes through __cc_shim.sh → python3 from_any_dir.py … and dies with
TypeError: relative_to() got an unexpected keyword argument 'walk_up'
Real-world case: yesme/hctl2#157 (fixed downstream in yesme/hctl2#165 by pinning a python-build-standalone 3.12 interpreter and injecting its absolute path into the bootstrap toolchain).
Suggested fix
Any of these would do; the first is a one-line change and drops the 3.12 requirement entirely:
Use os.path.relpath, which has walked up since forever:
I think we should not be depending on this python 3.9 provided by apple.
Elsewhere in the prelude, we use many other python scripts and surely don't want to be locked into supporting python 3.9 until however many years from now apple deleted it entirely.
Activity
research: 回填 buck2-prelude 上游 issue #1490/#1491 到复核记录,状态板记已报 (#167)
8Keep commentedon Sep 26, 2026
Apple has said that this python is deprecated and should not be used, maybe found this reference: https://developer.apple.com/forums/thread/698177
I think we should not be depending on this python 3.9 provided by apple.
Elsewhere in the prelude, we use many other python scripts and surely don't want to be locked into supporting python 3.9 until however many years from now apple deleted it entirely.
fix: support older bootstrap Python (#1518)