From a2d78fadf9cdafe42ef5cae2efbd48077fa31000 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 16 Apr 2024 16:43:44 +0800 Subject: [PATCH] fix(cli): wasi targets linker envs (#2044) --- cli/src/api/build.ts | 15 +++++++++++++++ cli/src/utils/target.ts | 1 + 2 files changed, 16 insertions(+) diff --git a/cli/src/api/build.ts b/cli/src/api/build.ts index 348c5cfc..4446bb5c 100644 --- a/cli/src/api/build.ts +++ b/cli/src/api/build.ts @@ -544,6 +544,21 @@ class Builder { 'bin', 'wasm-ld', ) + this.envs.CARGO_TARGET_WASM32_WASIP1_LINKER = join( + WASI_SDK_PATH, + 'bin', + 'wasm-ld', + ) + this.envs.CARGO_TARGET_WASM32_WASIP1_THREADS_LINKER = join( + WASI_SDK_PATH, + 'bin', + 'wasm-ld', + ) + this.envs.CARGO_TARGET_WASM32_WASIP2_LINKER = join( + WASI_SDK_PATH, + 'bin', + 'wasm-ld', + ) this.setEnvIfNotExists('CC', join(WASI_SDK_PATH, 'bin', 'clang')) this.setEnvIfNotExists('CXX', join(WASI_SDK_PATH, 'bin', 'clang++')) this.setEnvIfNotExists('AR', join(WASI_SDK_PATH, 'bin', 'ar')) diff --git a/cli/src/utils/target.ts b/cli/src/utils/target.ts index e900b721..3534fefe 100644 --- a/cli/src/utils/target.ts +++ b/cli/src/utils/target.ts @@ -110,6 +110,7 @@ export interface Target { */ export function parseTriple(rawTriple: string): Target { if ( + rawTriple === 'wasm32-wasi' || rawTriple === 'wasm32-wasi-preview1-threads' || rawTriple.startsWith('wasm32-wasip') ) {