Hello, I am new to emscripten and cmake and trying to make a simple application in cpp that uses openCV modules and compile it to wasm. I followed the documentation and tried to produce static library files *.a and the cpp file that references the opencv library as a .o file. This is where I had the error.
I ran the command cmake ../ -B./ -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64" -DWITH_1394=OFF -DWITH_FFMPEG=OFF -DBUILD_TESTS=OFF to build opencv statically into the current folder which is inside the openCV folder. Then I ran the commands - make - sudo make install. after this I navigated to where my cpp file is cvcaller.cpp, then ran - cmake . - make based on this I get the executable. It all works well here. I ran the produced executable and it shows the value as it should. But when I ran the following commands instead based on the documentation here <https://emscripten.org/docs/compiling/Building-Projects.html#build-system-issues>, I got the error. I cleared the folder which had the make files from before and ran the following commands. - emcmake cmake ../ -B./ -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64" -DWITH_1394=OFF - DWITH_FFMPEG=OFF -DBUILD_TESTS=OFF - emmake make error happens. I think the emcmake cmake is not working as it should in this case. make: make Scanning dependencies of target gen-pkgconfig [ 0%] Generate opencv.pc [ 0%] Built target gen-pkgconfig Scanning dependencies of target ittnotify [ 0%] Building C object 3rdparty/ittnotify/CMakeFiles/ittnotify.dir/src/ittnotify/ittnotify_static.c.o In file included from /Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/3rdparty/ittnotify/src/ittnotify/ittnotify_static.c:59: /Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/3rdparty/ittnotify/src/ittnotify/ittnotify_config.h:376:12: error: implicit declaration of function ' *TBB_machine_fetchadd4' is invalid in C99 [-Werror,-Wimplicit-function-declaration]return TBB_machine_fetchadd4(ptr, 1) + 1L;^1 error generated.emcc: error: '/Users/atul109/MyDocuments/work/new/emscripten_playground/emsdk/upstream/bin/clang -target wasm32-unknown-emscripten -D__EMSCRIPTEN_PTHREADS=1 -DEMSCRIPTEN -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major*=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=17 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/Users/atul109/MyDocuments/work/new/emscripten_playground/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -I/Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/3rdparty/ittnotify/include -I/Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/WasmBuild/3rdparty/ippicv/ippicv_lnx/icv/include -I/Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/WasmBuild/3rdparty/ippicv/ippicv_lnx/iw/include -I/Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/WasmBuild -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -pthread -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-implicit-fallthrough -Wno-undef -Wno-sign-compare -O3 -DNDEBUG -DNDEBUG -fPIC -c -pthread /Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/3rdparty/ittnotify/src/ittnotify/ittnotify_static.c -o CMakeFiles/ittnotify.dir/src/ittnotify/ittnotify_static.c.o' failed (1) make[2]: *** [3rdparty/ittnotify/CMakeFiles/ittnotify.dir/src/ittnotify/ittnotify_static.c.o] Error 1 make[1]: *** [3rdparty/ittnotify/CMakeFiles/ittnotify.dir/all] Error 2 make: *** [all] Error 2 emmake: error: 'make' failed (2) >From what I understand the ittnotify is causing error. But somehow it was fine when I did the normal cmake and make. It only does this for emcmake cmake and emmake make. /Users/atul109/MyDocuments/work/new/emscripten_playground/opencv-3.4.14/3rdparty/ittnotify/src/ittnotify/ittnotify_config.h:376:12: error: implicit declaration of function '__TBB_machine_fetchadd4' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return __TBB_machine_fetchadd4(ptr, 1) + 1L; ^ 1 error generated. Please help. I am stuck on this for a while now and have no clue as to what to do to get my cpp application run as wasm in browser because it has opencv modules in it. using openCV.js and calling it's functions through js is not an option for me. Thanks. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/ee415c2f-63ad-4e38-b4f4-03ffe4833c36n%40googlegroups.com.
