From 103b2df63b689a19169a7134a0b77d1c3c153943 Mon Sep 17 00:00:00 2001 From: Alex Zepeda Date: Fri, 28 Jul 2023 02:14:45 -0700 Subject: [PATCH 1/2] rustc_llvm: Link to libkstat on Solaris/SPARC getHostCPUName calls into libkstat but as of LLVM 16.0.6 libLLVMTargetParser is not explicitly linked against libkstat causing builds to fail due to undefined symbols. See also: llvm/llvm-project#64186 --- compiler/rustc_llvm/build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index aa1121d6bb3..107f2b65171 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -241,6 +241,11 @@ fn main() { cmd.arg("--system-libs"); } + // We need libkstat for getHostCPUName on SPARC builds. + if target.starts_with("sparcv9") && target.contains("solaris") { + println!("cargo:rustc-link-lib=kstat"); + } + if (target.starts_with("arm") && !target.contains("freebsd")) || target.starts_with("mips-") || target.starts_with("mipsel-") From 855388e9a2de1ddb99e83004941fb78d5ec796e4 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 13 Nov 2023 11:04:53 -0800 Subject: [PATCH 2/2] Mention LLVM 64186 in a comment --- compiler/rustc_llvm/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 107f2b65171..ba160ff28dc 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -242,6 +242,7 @@ fn main() { } // We need libkstat for getHostCPUName on SPARC builds. + // See also: https://github.com/llvm/llvm-project/issues/64186 if target.starts_with("sparcv9") && target.contains("solaris") { println!("cargo:rustc-link-lib=kstat"); }