Emscripten:我如何编译带有像 immintrin.h 这样的内在头文件的 c 文件?

问题描述

我正在尝试使用 emscripten(C 到 WASM)编译 CLBG 基准测试。然而,它们中的大多数都包含了内部头文件(如 ),这给了我很多错误(让我们以 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.

谁能帮帮我?我不明白这是否已经可以做到。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...