Skip to content

Commit 62cd02d

Browse files
committed
propagate build.python into cmake
If a suitable value of Python is not on PATH, one can still invoke x.py manually, which propagates BOOTSTRAP_PYTHON into the bootstrap environment. But building LLVM will abort with error messages about not being able to find Python, and instructions to set PYTHON_EXECUTABLE, because nothing is done with BOOTSTRAP_PYTHON when invoking cmake. Setting build.python in config.toml had no effect in this scenario, either To fix this, let's provide PYTHON_EXECUTABLE when invoking cmake; for the "normal" case of Python in PATH, this doesn't alter any behavior. For more unusual cases, however, this ensures cmake finds Python properly. (This change also ensures there are no differences between what bootstrap is using, and what cmake uses, which may be useful for consistency's sake.)
1 parent b0297f3 commit 62cd02d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bootstrap/native.rs

+4
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ impl Step for Llvm {
239239
cfg.define("LLVM_NATIVE_BUILD", builder.llvm_out(builder.config.build).join("build"));
240240
}
241241

242+
if let Some(ref python) = builder.config.python {
243+
cfg.define("PYTHON_EXECUTABLE", python);
244+
}
245+
242246
configure_cmake(builder, target, &mut cfg, false);
243247

244248
// FIXME: we don't actually need to build all LLVM tools and all LLVM

0 commit comments

Comments
 (0)