Skip to content

Commit 96d5dd6

Browse files
authored
Rollup merge of #109170 - eggyal:xc-linux-cmake, r=Mark-Simulacrum
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. r? bootstrap
2 parents e91364b + d10b113 commit 96d5dd6

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
@@ -567,6 +567,8 @@ fn configure_cmake(
567567
cfg.define("CMAKE_SYSTEM_NAME", "Haiku");
568568
} else if target.contains("solaris") || target.contains("illumos") {
569569
cfg.define("CMAKE_SYSTEM_NAME", "SunOS");
570+
} else if target.contains("linux") {
571+
cfg.define("CMAKE_SYSTEM_NAME", "Linux");
570572
}
571573
// When cross-compiling we should also set CMAKE_SYSTEM_VERSION, but in
572574
// that case like CMake we cannot easily determine system version either.

0 commit comments

Comments
 (0)