Skip to content

Commit 6123e21

Browse files
committed
fix(build): link proper cxx std libraries on windows-gnu{,llvm}
`*-pc-windows-gnullvm` targets use Clang toolchain, so the std library for it is libc++. `*-pc-windows-gnu` build also depends on `libatomic`
1 parent 696006d commit 6123e21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ fn print_link_flags() {
751751
} else if target.contains("apple")
752752
|| target.contains("freebsd")
753753
|| target.contains("openbsd")
754+
|| target.contains("gnullvm")
754755
{
755756
println!("cargo:rustc-link-lib=dylib=c++");
756757
} else if target.contains("android") {
@@ -776,6 +777,9 @@ fn print_link_flags() {
776777
} else {
777778
println!("cargo:rustc-link-lib=dylib=msvcprt");
778779
}
780+
} else if target.ends_with("windows-gnu") {
781+
// Clang-based toolchains don't use separate atomic library
782+
println!("cargo:rustc-link-lib=atomic")
779783
}
780784
}
781785

0 commit comments

Comments
 (0)