Skip to content

Commit d10b113

Browse files
committed
Set CMAKE_SYSTEM_NAME for Linux targets
When bootstrap compiles native dependencies like LLVM, it should set CMAKE_SYSTEM_NAME for the target system; otherwise cmake may not identify that it is cross-compiling. In particular, when building a Linux rustc on a macOS host, cmake was including `-isysroot /path/to/macOS.sdk` options that caused things to break. By setting `CMAKE_SYSTEM_NAME=Linux` when building for Linux targets, the macOS SDK is no longer passed as sysroot to the compiler.
1 parent e4b9f86 commit d10b113

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/bootstrap/native.rs

+2
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ fn configure_cmake(
570570
cfg.define("CMAKE_SYSTEM_NAME", "Haiku");
571571
} else if target.contains("solaris") || target.contains("illumos") {
572572
cfg.define("CMAKE_SYSTEM_NAME", "SunOS");
573+
} else if target.contains("linux") {
574+
cfg.define("CMAKE_SYSTEM_NAME", "Linux");
573575
}
574576
// When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
575577
// that case like CMake we cannot easily determine system version either.

0 commit comments

Comments
 (0)