Skip to content

Commit 2d154e9

Browse files
committed
fix(onnxruntime): pass WASM_ASYNC_COMPILATION via CMake defines
- Changed from EMCC_CFLAGS to --cmake_extra_defines - Fixes compilation error: linker flag being treated as compiler flag - ONNX Runtime build uses -Werror, treating warnings as errors
1 parent 6266438 commit 2d154e9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/onnxruntime/scripts/build.mjs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,21 @@ async function build() {
135135

136136
const buildScript = path.join(ONNX_SOURCE_DIR, 'build.sh')
137137

138-
// Set Emscripten flags for synchronous WASM compilation.
139-
const env = {
140-
...process.env,
141-
EMCC_CFLAGS: '-sWASM_ASYNC_COMPILATION=0',
142-
}
138+
// Note: WASM_ASYNC_COMPILATION=0 is required for bundling but causes compilation
139+
// errors when passed via EMCC_CFLAGS (it's a linker flag, not compiler flag).
140+
// ONNX Runtime's build system handles Emscripten settings through CMake.
141+
// We pass it through --emscripten_settings which goes to EMSCRIPTEN_SETTINGS.
143142

144143
await spawn(buildScript, [
145144
'--config', 'Release',
146145
'--build_wasm',
147146
'--skip_tests',
148147
'--parallel',
148+
'--cmake_extra_defines', 'onnxruntime_EMSCRIPTEN_SETTINGS=WASM_ASYNC_COMPILATION=0',
149149
], {
150150
cwd: ONNX_SOURCE_DIR,
151151
shell: WIN32,
152152
stdio: 'inherit',
153-
env,
154153
})
155154

156155
const duration = formatDuration(Date.now() - startTime)

0 commit comments

Comments
 (0)