Skip to content

Commit 552f9c9

Browse files
authored
chore(cli): setjmp link path (#2808)
1 parent 02bd12a commit 552f9c9

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

cli/src/api/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,11 @@ class Builder {
625625
)
626626
this.setEnvIfNotExists(
627627
'TARGET_CFLAGS',
628-
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -mllvm -wasm-enable-sjlj -lsetjmp`,
628+
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -mllvm -wasm-enable-sjlj`,
629629
)
630630
this.setEnvIfNotExists(
631631
'TARGET_CXXFLAGS',
632-
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -mllvm -wasm-enable-sjlj -lsetjmp`,
632+
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -mllvm -wasm-enable-sjlj`,
633633
)
634634
this.setEnvIfNotExists(
635635
`TARGET_LDFLAGS`,

crates/build/src/wasi.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,18 @@ pub fn setup() {
4444
crt_reactor_path.display()
4545
);
4646
}
47-
if let Ok(setjmp_link_dir) = env::var("SETJMP_LINK_DIR") {
48-
println!("cargo:rustc-link-search={setjmp_link_dir}");
49-
println!("cargo:rustc-link-lib=static=setjmp-mt");
50-
}
5147
if let Ok(wasi_sdk_path) = env::var("WASI_SDK_PATH") {
5248
println!(
5349
"cargo:rustc-link-search={wasi_sdk_path}/share/wasi-sysroot/lib/wasm32-wasip1-threads"
5450
);
51+
let setjmp_static_lib = Path::new(&wasi_sdk_path)
52+
.join("share")
53+
.join("wasi-sysroot")
54+
.join("lib")
55+
.join("wasm32-wasip1-threads")
56+
.join("libsetjmp.a");
57+
if setjmp_static_lib.exists() {
58+
println!("cargo:rustc-link-lib=static=setjmp");
59+
}
5560
}
5661
}

0 commit comments

Comments
 (0)