Skip to content

Commit 6aa6fde

Browse files
committed
fix(candle-kernels): conditionally link stdc++ for non-MSVC targets
On Windows with MSVC, linking against stdc++ fails because it is a GNU/GCC library that does not exist in the MSVC toolchain. MSVC uses its own C++ runtime which is linked automatically. This fix wraps the stdc++ link directive in a target check, matching the existing pattern in candle-flash-attn/build.rs. Fixes #3277
1 parent 3a0d1cb commit 6aa6fde

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

candle-kernels/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ fn main() {
4646
println!("cargo:rustc-link-search={}", out_dir.display());
4747
println!("cargo:rustc-link-lib=moe");
4848
println!("cargo:rustc-link-lib=dylib=cudart");
49-
println!("cargo:rustc-link-lib=stdc++");
49+
if !is_target_msvc {
50+
println!("cargo:rustc-link-lib=stdc++");
51+
}
5052
}
5153

5254
fn remove_lines<P: AsRef<std::path::Path>>(file: P, patterns: &[&str]) {

0 commit comments

Comments
 (0)