Skip to content

Commit

Permalink
Fix linking libc++ on wasi
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Sep 24, 2024
1 parent 22ceada commit ed82c66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion config.llvm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ prefix = "dist"
sysconfdir = "etc"

[target.'wasm32-wasip1-threads']
wasi-root = "wasi-sdk-24.0-x86_64-linux/share/wasi-sysroot"
wasi-root = "/home/bjorn/Projects/rust/wasi-sdk-24.0-x86_64-linux/share/wasi-sysroot"
# codegen-backends = ["cranelift"]
cc = "/home/bjorn/Projects/rust/wasi-sdk-24.0-x86_64-linux/bin/clang"
cxx = "/home/bjorn/Projects/rust/wasi-sdk-24.0-x86_64-linux/bin/clang"
linker = "wasi-sdk-24.0-x86_64-linux/bin/clang"
codegen-backends = ["llvm"]

Expand Down
4 changes: 3 additions & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,9 @@ fn rustc_llvm_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelect

// Building with a static libstdc++ is only supported on linux right now,
// not for MSVC or macOS
if builder.config.llvm_static_stdcpp
if target.contains("wasi") {
cargo.env("LLVM_STATIC_STDCPP", dbg!(builder.wasi_libdir(target).unwrap().join("libc++.a")));
} else if builder.config.llvm_static_stdcpp
&& !target.contains("freebsd")
&& !target.is_msvc()
&& !target.contains("apple")
Expand Down

0 comments on commit ed82c66

Please sign in to comment.