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
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, I got the error.
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.