Ask Your Question

Revision history [back]

OpenCV wasm not building

Hi guys,

I've been trying to build a piece of code in webassembly that would use OpenCV.

I took https://github.com/mpizenberg/emscripten-opencv to start building, this worked well, but when I try adding cv::resize to be able to resize an image, that's when I have some issues:

make[1]: Entering directory '/code/build'
make[2]: Entering directory '/code/build'
make[3]: Entering directory '/code/build'
Scanning dependencies of target hello
make[3]: Leaving directory '/code/build'
make[3]: Entering directory '/code/build'
[ 50%] Building CXX object CMakeFiles/hello.dir/source/main.cpp.o
[100%] Linking CXX executable hello.js
error: undefined symbol: _Z7cvFloorRKN2cv10softdoubleE
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: _Z7cvRoundRKN2cv10softdoubleE
error: undefined symbol: _Z9cvRound64RKN2cv10softdoubleE
error: undefined symbol: _ZN2cv10softdoubleC1Ei
error: undefined symbol: _ZN2cv10softdoubleC1Ex
error: undefined symbol: _ZNK2cv10softdoubledvERKS0_
error: undefined symbol: _ZNK2cv10softdoublemiERKS0_
error: undefined symbol: _ZNK2cv10softdoublemlERKS0_
error: undefined symbol: _ZNK2cv10softdoubleplERKS0_
Error: Aborting compilation due to previous errors
shared:ERROR: '/emsdk_portable/node/bin/node /emsdk_portable/sdk/src/compiler.js /tmp/tmpS6bxjF.txt /emsdk_portable/sdk/src/embind/emval.js /emsdk_portable/sdk/src/embind/embind.js /emsdk_portable/sdk/src/library_pthread_stub.js' failed (1)
CMakeFiles/hello.dir/build.make:95: recipe for target 'hello.js' failed
make[3]: *** [hello.js] Error 1
make[3]: Leaving directory '/code/build'
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/hello.dir/all' failed
make[2]: *** [CMakeFiles/hello.dir/all] Error 2
make[2]: Leaving directory '/code/build'
Makefile:83: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/code/build'
Makefile:5: recipe for target 'build' failed
make: *** [build] Error 2
The command '/bin/sh -c make build' returned a non-zero code: 2
make: *** [all] Error 2

I tried wrapping up my problem here https://github.com/jdrouet/opencv-wasm, you can pull it and run make, it'll build with docker.

Do you have any idea of how I could fix my issue?