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 execs the C compiler with os.execl, which does not search PATH — fails with ENOENT under the default system_cxx_toolchain (bare clang) #1491
prelude/rust/tools/from_any_dir.py re-executes the C compiler with os.execl(cc[0], …). execl does not search PATH, but the default system_cxx_toolchain() (prelude//toolchains/cxx/clang:path_clang_tools) hands the shim a bare command name such as clang. The combination fails with ENOENT for every cargo_buildscript that compiles C, even though the very same toolchain compiles ordinary cxx_library targets fine — so a configuration that works everywhere else in the prelude breaks only inside the build-script shim.
Where
prelude/rust/tools/from_any_dir.py line 68 (unchanged between the 2026-08-22 tag and main as of 2026-09-04):
prelude/rust/cargo_buildscript.bzl: env["CC"] = _make_cc_shim(cmd = cmd_args(cxx_toolchain_info.c_compiler_info.compiler, …)) — cc[0] is exactly what the cxx toolchain declares as its compiler.
prelude/toolchains/cxx.bzl: system_cxx_toolchain resolves an unset compiler to the path_clang_tools default, i.e. a bare clang looked up on PATH.
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:
exec failed: ['clang', '--ld-path=…/__ld_shim.sh', …]
FileNotFoundError: [Errno 2] No such file or directory: 'clang'
cxx_library targets built with the same toolchain in the same invocation succeed, because there the executor resolves clang normally.
Real-world case: yesme/hctl2#157 (worked around downstream in yesme/hctl2#165 by resolving cc/c++/ar to absolute paths in the launcher and passing them to system_cxx_toolchain via --config). Note for macOS: the absolute path has to be the /usr/bin/clang xcrun shim, not the binary inside Xcode.app, because only the shim injects the active SDK's -isysroot — one more reason a bare name is the natural configuration and the shim should be able to consume it.
or use os.execvp, which does the PATH lookup itself (falling back to os.defpath when PATH is absent from the action environment).
Happy to send a PR if that is the preferred direction.
Environment
buck2 prelude 2026-08-22 (file identical on main at 2026-09-04)
Observed on macOS 26.6.2 arm64; the execl semantics are platform-independent, and the downstream workaround had to resolve absolute paths on Linux x86_64 and macOS x86_64 as well
Activity
rust: Always set OPT_LEVEL for build scripts (#1669)