fix(cli,build): build params (#1960)

This commit is contained in:
LongYinan 2024-02-19 18:09:34 +08:00 committed by GitHub
parent f7376f1e97
commit ad35076d07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View file

@ -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`,

View file

@ -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");
@ -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");
}
}