From ce4f16543d644f1c8a4f158f9b5de13f6301741d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Sun, 26 Jan 2025 16:18:40 +0100 Subject: [PATCH] fix wasm build Forwarded: not-needed Reviewed-By: Yadd Last-Update: 2024-04-05 Gbp-Pq: Name fix-wasm-build.patch --- llhttp/Makefile | 2 +- llhttp/bin/build_wasm.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/llhttp/Makefile b/llhttp/Makefile index d9c6d35..f3afeba 100644 --- a/llhttp/Makefile +++ b/llhttp/Makefile @@ -81,7 +81,7 @@ postversion: release git checkout main generate: - npx ts-node bin/generate.ts + ts-node bin/generate.ts install: build/libllhttp.a build/libllhttp.so $(INSTALL) -d $(DESTDIR)$(INCLUDEDIR) diff --git a/llhttp/bin/build_wasm.ts b/llhttp/bin/build_wasm.ts index 95c1ced..d6183b5 100644 --- a/llhttp/bin/build_wasm.ts +++ b/llhttp/bin/build_wasm.ts @@ -25,6 +25,7 @@ if (process.argv[2] === '--setup') { mkdirSync(join(WASM_SRC, 'build')); process.exit(0); } catch (error: unknown) { +// @ts-ignore if (isErrorWithCode(error) && error.code !== 'EEXIST') { throw error; } @@ -52,6 +53,7 @@ if (process.argv[2] === '--docker') { try { mkdirSync(WASM_OUT); } catch (error: unknown) { +// @ts-ignore if (isErrorWithCode(error) && error.code !== 'EEXIST') { throw error; } @@ -63,12 +65,14 @@ execSync('npm run build', { cwd: WASM_SRC, stdio: 'inherit' }); // Build wasm binary execSync( `clang \ - --sysroot=/usr/share/wasi-sysroot \ + -nodefaultlibs \ + --sysroot=/usr \ -target wasm32-unknown-wasi \ -Ofast \ -fno-exceptions \ -fvisibility=hidden \ -mexec-model=reactor \ + -Wl,-lc \ -Wl,-error-limit=0 \ -Wl,-O3 \ -Wl,--lto-O3 \ -- 2.30.2