簡體   English   中英

Emscripten:我怎樣才能編譯一個 c 文件與一個內在的 header 像 immintrin.h?

[英]Emscripten: how can i compile a c file with an intrinsic header like immintrin.h?

我正在嘗試使用 emscripten(C 到 WASM)編譯 CLBG 基准。 然而,它們中的大多數都包含了內部標題(如 <immintrin.h>),這給了我很多錯誤(讓我們使用 nbody.c 作為示例),如下所示:

nbody.c:137:20: error: use of undeclared identifier '__m128d' static alignas(__m128d) double

我已經嘗試使用這些標志進行編譯

emcc nbody.c -o nbody.js -O2 -s WASM=1 -msse2 -msimd128

它編譯。 但是,當我嘗試使用 nodejs 運行 nbody.js 時,它不起作用。 我也嘗試過運行nodejs

--experimental-wasm-simd

就像這個git告訴的那樣,但它也不起作用。 它說:

failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Compiling function #4:"main" failed: invalid value type 'Simd128', enable with --experimental-wasm-simd @+422
CompileError: WebAssembly.instantiate(): Compiling function #4:"main" failed: invalid value type 'Simd128', enable with --experimental-wasm-simd @+422
RuntimeError: abort(CompileError: WebAssembly.instantiate(): Compiling function #4:"main" failed: invalid value type 'Simd128', enable with --experimental-wasm-simd @+422).
Build with -s ASSERTIONS=1 for more info.

誰能幫我一把? 我不明白這是否已經可以做到。

將這些編譯標志添加到 C 和 CXX 標志

-fPIC -Wno-implicit-function-declaration -msse2 -msimd128 -experimental-wasm-simd

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM