Skip to content

Commit

Permalink
fix(cli,build): build params (#1960)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 19, 2024
1 parent f7376f1 commit ad35076
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cli/src/api/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ class Builder {
this.setEnvIfNotExists('RANLIB', join(WASI_SDK_PATH, 'bin', 'ranlib'))
this.setEnvIfNotExists(
'CFLAGS',
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -I${setjmpInclude}`,
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -mllvm -wasm-enable-sjlj -I${setjmpInclude}`,
)
this.setEnvIfNotExists(
'CXXFLAGS',
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -I${setjmpInclude}`,
`--target=wasm32-wasi-threads --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot -pthread -mllvm -wasm-enable-sjlj -I${setjmpInclude}`,
)
this.setEnvIfNotExists(
`LDFLAGS`,
Expand Down
10 changes: 5 additions & 5 deletions crates/build/src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ pub fn setup() {
let link_dir = env::var("EMNAPI_LINK_DIR").expect("EMNAPI_LINK_DIR must be set");
println!("cargo:rerun-if-env-changed=EMNAPI_LINK_DIR");
println!("cargo:rerun-if-env-changed=WASI_REGISTER_TMP_PATH");
if let Ok(setjmp_link_dir) = env::var("SETJMP_LINK_DIR") {
println!("cargo:rustc-link-search={link_dir}");
println!("cargo:rustc-link-search={setjmp_link_dir}");
}
println!("cargo:rustc-link-search={link_dir}");
println!("cargo:rustc-link-lib=static=emnapi-basic-mt");
println!("cargo:rustc-link-lib=static=setjmp-mt");
println!("cargo:rustc-link-arg=--export-dynamic");
println!("cargo:rustc-link-arg=--export=malloc");
println!("cargo:rustc-link-arg=--export=free");
Expand All @@ -26,4 +22,8 @@ pub fn setup() {
// 0x800000 bytes = 8MiB
println!("cargo:rustc-link-arg=-zstack-size=0x800000");
println!("cargo:rustc-link-arg=--no-check-features");
if let Ok(setjmp_link_dir) = env::var("SETJMP_LINK_DIR") {
println!("cargo:rustc-link-search={setjmp_link_dir}");
println!("cargo:rustc-link-lib=static=setjmp-mt");
}
}

0 comments on commit ad35076

Please sign in to comment.