在将 C++ 代码(具有 dlib 和 opencv)编译为 WASM 时遇到问题

Facing problem in compilation of C++ code (having dlib and opencv) to WASM

我正在尝试将 C++ 代码编译为 WASM,但遇到了问题。我的 C++ 代码包括 dlib 和 OpenCV 库。我已经为 C++ 环境成功编译了 OpenCV 和 dlib。另外,我已经在我的系统中安装了 emscripten。

最近我在编译过程中遇到了包含 dlib 和 OpenCV 库的问题。所以我又问了一个问题here。现在虽然我能够成功地提供头文件信息。但是现在我无法编译代码。当我执行以下命令时:

emcc -msse3 -msimd128 -std=c++11 -O3 -I ../dlib -I ../opencv/build/include main.cpp -lstdc++ -lpthread -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -s TOTAL_MEMORY=1024MB -s "EXTRA_EXPORTED_RUNTIME_METHODS=['ccall', 'cwrap']" -s WASM=1 -o main.js

然后我收到以下错误:

In file included from main.cpp:5:
In file included from ../dlib\dlib/image_processing/frontal_face_detector.h:8:
In file included from ../dlib\dlib/image_processing/../image_processing/scan_fhog_pyramid.h:8:
In file included from ../dlib\dlib/image_processing/../image_transforms.h:14:
In file included from ../dlib\dlib/image_processing/../image_transforms/spatial_filtering.h:13:
In file included from ../dlib\dlib/image_processing/../image_transforms/../simd.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd4f.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd_check.h:88:
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:13:19: error: typedef redefinition with different types
      ('__attribute__((__vector_size__(1 * sizeof(long long)))) long long' (vector of 1 'long long' value) vs
      '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values))
typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8)));
                  ^
C:\emsdk\upstream\emscripten\system\include\SSE\xmmintrin.h:22:15: note: previous definition is here
typedef float __m64 __attribute__((__vector_size__(8), __aligned__(8)));
              ^
In file included from main.cpp:5:
In file included from ../dlib\dlib/image_processing/frontal_face_detector.h:8:
In file included from ../dlib\dlib/image_processing/../image_processing/scan_fhog_pyramid.h:8:
In file included from ../dlib\dlib/image_processing/../image_transforms.h:14:
In file included from ../dlib\dlib/image_processing/../image_transforms/spatial_filtering.h:13:
In file included from ../dlib\dlib/image_processing/../image_transforms/../simd.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd4f.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd_check.h:88:
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms';
      did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:33:5: note: '__builtin_isless' declared here
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:33:25: error: too few arguments to function call, expected 2,
      have 0
    __builtin_ia32_emms();
                        ^
C:\emsdk\upstream\lib\clang.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);
                  ^
C:\emsdk\upstream\lib\clang.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);
           ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:129:19: error: use of undeclared identifier
      '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:159:19: error: use of undeclared identifier
      '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:189:19: error: use of undeclared identifier
      '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:216:19: error: use of undeclared identifier
      '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:239:19: error: use of undeclared identifier
      '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:260:19: error: use of undeclared identifier
      '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:287:19: error: use of undeclared identifier
      '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:310:19: error: use of undeclared identifier
      '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:331:19: error: use of undeclared identifier
      '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:352:19: error: use of undeclared identifier
      '__builtin_ia32_paddb'
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:373:19: error: use of undeclared identifier
      '__builtin_ia32_paddw'
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:394:19: error: use of undeclared identifier
      '__builtin_ia32_paddd'
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:416:19: error: use of undeclared identifier
      '__builtin_ia32_paddsb'
    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:439:19: error: use of undeclared identifier
      '__builtin_ia32_paddsw'
    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
emcc: error: 'C:/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=19 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -D__SSE__=1 -D__SSE2__=1 -D__SSE3__=1 -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libcxx -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libcxxabi\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libunwind\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\compat -Xclang -isystemC:\emsdk\upstream\emscripten\system\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libc -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libc\musl\arch\emscripten -Xclang -isystemC:\emsdk\upstream\emscripten\system\local\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SSE -Xclang -isystemC:\emsdk\upstream\emscripten\cache\wasm\include -DEMSCRIPTEN -fignore-exceptions -D__EMSCRIPTEN_PTHREADS__=1 -msimd128 -std=c++11 -O3 -I../dlib -I../opencv/build/include -pthread -pthread main.cpp -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SDL -c -o C:\Users\Nitin\AppData\Local\Temp\emscripten_temp_l6l_woh0\main_0.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (1)

In file included from main.cpp:5:
In file included from ../dlib\dlib/image_processing/frontal_face_detector.h:8:
In file included from ../dlib\dlib/image_processing/../image_processing/scan_fhog_pyramid.h:8:
In file included from ../dlib\dlib/image_processing/../image_transforms.h:14:
In file included from ../dlib\dlib/image_processing/../image_transforms/spatial_filtering.h:13:
In file included from ../dlib\dlib/image_processing/../image_transforms/../simd.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd4f.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd_check.h:88:
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:13:19: error: typedef redefinition with different types
      ('__attribute__((__vector_size__(1 * sizeof(long long)))) long long' (vector of 1 'long long' value) vs
      '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values))
typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8)));
                  ^
C:\emsdk\upstream\emscripten\system\include\SSE\xmmintrin.h:22:15: note: previous definition is here
typedef float __m64 __attribute__((__vector_size__(8), __aligned__(8)));
              ^
In file included from main.cpp:5:
In file included from ../dlib\dlib/image_processing/frontal_face_detector.h:8:
In file included from ../dlib\dlib/image_processing/../image_processing/scan_fhog_pyramid.h:8:
In file included from ../dlib\dlib/image_processing/../image_transforms.h:14:
In file included from ../dlib\dlib/image_processing/../image_transforms/spatial_filtering.h:13:
In file included from ../dlib\dlib/image_processing/../image_transforms/../simd.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd4f.h:6:
In file included from ../dlib\dlib/image_processing/../simd/simd_check.h:88:
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms';
      did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:33:5: note: '__builtin_isless' declared here
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:33:25: error: too few arguments to function call, expected 2,
      have 0
    __builtin_ia32_emms();
                        ^
C:\emsdk\upstream\lib\clang.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);
                  ^
C:\emsdk\upstream\lib\clang.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);
           ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:129:19: error: use of undeclared identifier
      '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:159:19: error: use of undeclared identifier
      '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:189:19: error: use of undeclared identifier
      '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:216:19: error: use of undeclared identifier
      '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:239:19: error: use of undeclared identifier
      '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:260:19: error: use of undeclared identifier
      '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:287:19: error: use of undeclared identifier
      '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:310:19: error: use of undeclared identifier
      '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:331:19: error: use of undeclared identifier
      '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:352:19: error: use of undeclared identifier
      '__builtin_ia32_paddb'
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:373:19: error: use of undeclared identifier
      '__builtin_ia32_paddw'
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:394:19: error: use of undeclared identifier
      '__builtin_ia32_paddd'
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:416:19: error: use of undeclared identifier
      '__builtin_ia32_paddsb'
    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
                  ^
C:\emsdk\upstream\lib\clang.0.0\include\mmintrin.h:439:19: error: use of undeclared identifier
      '__builtin_ia32_paddsw'
    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
emcc: error: 'C:/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=19 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -D__SSE__=1 -D__SSE2__=1 -D__SSE3__=1 -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libcxx -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libcxxabi\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libunwind\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\compat -Xclang -isystemC:\emsdk\upstream\emscripten\system\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libc -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libc\musl\arch\emscripten -Xclang -isystemC:\emsdk\upstream\emscripten\system\local\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SSE -Xclang -isystemC:\emsdk\upstream\emscripten\cache\wasm\include -DEMSCRIPTEN -fignore-exceptions -D__EMSCRIPTEN_PTHREADS__=1 -msimd128 -std=c++11 -O3 -I../dlib -I../opencv/build/include -pthread -pthread main.cpp -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SDL -c -o C:\Users\Nitin\AppData\Local\Temp\emscripten_temp_l6l_woh0\main_0.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (1)

现在我已经通过在

上发表评论来消除了这个错误

#define DLIB_SIMd_CHECK_Hh_

里面 dlib/dlib/simd/simd_check.h

现在上面的错误消失了,但我现在面临以下错误。

Assertion failed: Legal->getLAI()->getSymbolicStrides().empty() && "Specializing for stride == 1 under -Os/-Oz", file C:\b\s\w\ir\cache\builder\emscripten-releases\llvm-project\llvm\lib\Transforms\Vectorize\LoopVectorize.cpp, line 4941
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: C:/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=19 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -D__SSE__=1 -D__SSE2__=1 -D__SSE3__=1 -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libcxx -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libcxxabi\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libunwind\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\compat -Xclang -isystemC:\emsdk\upstream\emscripten\system\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libc -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libc\musl\arch\emscripten -Xclang -isystemC:\emsdk\upstream\emscripten\system\local\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SSE -Xclang -isystemC:\emsdk\upstream\emscripten\cache\wasm\include -DEMSCRIPTEN -fignore-exceptions -msimd128 -std=c++11 -O3 -I../dlib -I../opencv/build/include main.cpp -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SDL -c -o C:\Users\Nitin\AppData\Local\Temp\emscripten_temp_43tvpnaz\main_0.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'main.cpp'.
4.      Running pass 'Loop Vectorization' on function '@_ZN4dlib4svd4INS_9matrix_opINS_8op_transINS_6matrixIdLl3ELl0ENS_33memory_manager_stateless_kernel_1IcEENS_16row_major_layoutEEEEEEELl0ELl1ELl0ELl0ELl3ELl0ES5_S5_S5_S6_EElNS_10svd_u_modeEbRKNS_10matrix_expIT_EERNS3_INSC_4typeEXT2_EXT3_ET6_T9_EERNS3_ISG_XT0_EXT1_ET7_SI_EERNS3_ISG_XT4_EXT5_ET8_SI_EE'
 #0 0x00007ff770728146 (C:\emsdk\upstream\bin\clang++.exe+0x10a8146)
 #1 0x00007ffa5a82cb7d (C:\Windows\System32\ucrtbase.dll+0x6cb7d)
 #2 0x00007ffa5a82db81 (C:\Windows\System32\ucrtbase.dll+0x6db81)
 #3 0x00007ffa5a82f5be (C:\Windows\System32\ucrtbase.dll+0x6f5be)
 #4 0x00007ffa5a82f4b5 (C:\Windows\System32\ucrtbase.dll+0x6f4b5)
 #5 0x00007ffa5a82f841 (C:\Windows\System32\ucrtbase.dll+0x6f841)
 #6 0x00007ff7708d516e (C:\emsdk\upstream\bin\clang++.exe+0x125516e)
 #7 0x00007ff7708d5665 (C:\emsdk\upstream\bin\clang++.exe+0x1255665)
 #8 0x00007ff7708e139a (C:\emsdk\upstream\bin\clang++.exe+0x126139a)
 #9 0x00007ff7708ec040 (C:\emsdk\upstream\bin\clang++.exe+0x126c040)
#10 0x00007ff7708ef4da (C:\emsdk\upstream\bin\clang++.exe+0x126f4da)
#11 0x00007ff7708f1e8f (C:\emsdk\upstream\bin\clang++.exe+0x1271e8f)
#12 0x00007ff77008f8b4 (C:\emsdk\upstream\bin\clang++.exe+0xa0f8b4)
#13 0x00007ff77008fc03 (C:\emsdk\upstream\bin\clang++.exe+0xa0fc03)
#14 0x00007ff7700902ed (C:\emsdk\upstream\bin\clang++.exe+0xa102ed)
#15 0x00007ff770a0585f (C:\emsdk\upstream\bin\clang++.exe+0x138585f)
#16 0x00007ff7731713bf (C:\emsdk\upstream\bin\clang++.exe+0x3af13bf)
#17 0x00007ff771e7a4e3 (C:\emsdk\upstream\bin\clang++.exe+0x27fa4e3)
#18 0x00007ff770fdd215 (C:\emsdk\upstream\bin\clang++.exe+0x195d215)
#19 0x00007ff770f99f2c (C:\emsdk\upstream\bin\clang++.exe+0x1919f2c)
#20 0x00007ff771051c0d (C:\emsdk\upstream\bin\clang++.exe+0x19d1c0d)
#21 0x00007ff76f6875fa (C:\emsdk\upstream\bin\clang++.exe+0x75fa)
#22 0x00007ff76f684914 (C:\emsdk\upstream\bin\clang++.exe+0x4914)
#23 0x00007ff770f2e396 (C:\emsdk\upstream\bin\clang++.exe+0x18ae396)
#24 0x00007ff770711543 (C:\emsdk\upstream\bin\clang++.exe+0x1091543)
#25 0x00007ff770f2dbd3 (C:\emsdk\upstream\bin\clang++.exe+0x18adbd3)
#26 0x00007ff770e2f8a5 (C:\emsdk\upstream\bin\clang++.exe+0x17af8a5)
#27 0x00007ff770e2fc4b (C:\emsdk\upstream\bin\clang++.exe+0x17afc4b)
#28 0x00007ff770e1c2a7 (C:\emsdk\upstream\bin\clang++.exe+0x179c2a7)
#29 0x00007ff76f6842cf (C:\emsdk\upstream\bin\clang++.exe+0x42cf)
#30 0x00007ff773199650 (C:\emsdk\upstream\bin\clang++.exe+0x3b19650)
#31 0x00007ffa5b887bd4 (C:\Windows\System32\KERNEL32.DLL+0x17bd4)
#32 0x00007ffa5d74ce51 (C:\Windows\SYSTEM32\ntdll.dll+0x6ce51)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 11.0.0 (Cswircachegitchromium.googlesource.com-external-github.com-llvm-llvm--project 7bf299c8d8d59304fb821f8811618cdeb1d1f1fd)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:/emsdk/upstream/bin
clang++: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: C:\Users\Nitin\AppData\Local\Temp\main-f68ec8.cpp
clang++: note: diagnostic msg: C:\Users\Nitin\AppData\Local\Temp\main-f68ec8.sh
clang++: note: diagnostic msg:

********************
em++: error: 'C:/emsdk/upstream/bin\clang++.exe -target wasm32-unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=39 -D__EMSCRIPTEN_tiny__=19 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -D__SSE__=1 -D__SSE2__=1 -D__SSE3__=1 -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libcxx -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libcxxabi\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libunwind\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\compat -Xclang -isystemC:\emsdk\upstream\emscripten\system\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\libc -Xclang -isystemC:\emsdk\upstream\emscripten\system\lib\libc\musl\arch\emscripten -Xclang -isystemC:\emsdk\upstream\emscripten\system\local\include -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SSE -Xclang -isystemC:\emsdk\upstream\emscripten\cache\wasm\include -DEMSCRIPTEN -fignore-exceptions -msimd128 -std=c++11 -O3 -I../dlib -I../opencv/build/include main.cpp -Xclang -isystemC:\emsdk\upstream\emscripten\system\include\SDL -c -o C:\Users\Nitin\AppData\Local\Temp\emscripten_temp_43tvpnaz\main_0.o -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (1)

请帮助我。

__builtin_ia32_emms()

ia32 是 x86 架构的名称。因此,我认为 dlib 没有 webassembly 支持。所有其他错误都具有相同的来源。 (喜欢__builtin_ia32_paddd) 我只能猜测 typedef 重新定义。我想,这是因为 xmmintrin.hmmintrin.h 被包括在内,尽管 immintrin.h 存在。

您似乎包含了错误的头文件。 而不是 emsdk\upstream\lib\clang.0.0\include,它应该都在 emsdk\upstream\emscripten\system\include\SSE

之下