fix(cli): wasi targets linker envs (#2044)

This commit is contained in:
LongYinan 2024-04-16 16:43:44 +08:00 committed by GitHub
parent 6871b67589
commit a2d78fadf9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -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'))

View file

@ -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')
) {