这是本文将.cpp文件转换为.wasm文件的后续问题
我正试图在linux上使用emscripten将我的c++文件转换为.wasm。我遇到了这个错误:
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:188:10: error: use of undeclared identifier '__builtin_ia32_readeflags_u32'
return __builtin_ia32_readeflags_u32();
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:194:3: error: use of undeclared identifier '__builtin_ia32_writeeflags_u32'
__builtin_ia32_writeeflags_u32(__f);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:284:10: error: use of undeclared identifier '__builtin_ia32_crc32qi'
return __builtin_ia32_crc32qi(__C, __D);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:305:10: error: use of undeclared identifier '__builtin_ia32_crc32hi'
return __builtin_ia32_crc32hi(__C, __D);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:326:10: error: use of undeclared identifier '__builtin_ia32_crc32si'
return __builtin_ia32_crc32si(__C, __D);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:354:10: error: use of undeclared identifier '__builtin_ia32_rdpmc'
return __builtin_ia32_rdpmc(__A);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:360:10: error: use of undeclared identifier '__builtin_ia32_rdtscp'
return __builtin_ia32_rdtscp(__A);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/ia32intrin.h:369:3: error: use of undeclared identifier '__builtin_ia32_wbinvd'
__builtin_ia32_wbinvd();
^
In file included from sealdemo.cpp:1:
In file included from SEAL/native/src/seal/seal.h:6:
In file included from SEAL/native/src/seal/biguint.h:9:
In file included from SEAL/native/src/seal/memorymanager.h:10:
In file included from SEAL/native/src/seal/util/defines.h:62:
In file included from SEAL/native/src/seal/util/clang.h:18:
In file included from /home/maria/emsdk/upstream/lib/clang/10.0.0/include/x86intrin.h:15:
In file included from /home/maria/emsdk/upstream/lib/clang/10.0.0/include/immintrin.h:14:
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:33:5: note: '__builtin_isless' declared here
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/home/maria/emsdk/upstream/lib/clang/10.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
shared:ERROR: '/home/maria/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscrip
有人能帮助吗
为WebAssembly构建时不能/不应该包含x86intrin.h
。看起来您需要在没有SEAL_USE_INTRIN
的情况下进行构建:https://github.com/microsoft/SEAL/blob/master/native/src/seal/util/clang.h#L18
我已经能够使用带内部函数的emscripten(#include <wasm_simd128.h>
(将Microsoft SEAL库编译到WebAssembly,但这是可选的。
就其本身而言,工具链从未给过我这个特定的错误,因为emcmake
步骤总是无法找到必要的头,并且在没有优化的情况下进行编译。
听起来您可能没有使用适当的emcmake
或em++
参数。此外,如果您想使用内部函数,您将需要gcc.h和clang.h(位于SEAL/native/src/SEAL/util/中(中的一些条件来使用wasm_simd128.h
而不是x86intrin.h
请随意检查我的实现和/或构建在Mac和Linux(Ubuntu(上编译的脚本:https://github.com/morfix-io/node-seal
如果你只想要一个工作库,也可以下载npm包:https://www.npmjs.com/package/node-seal