-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Compilation of opencv.js fails with last version of Emscripten toolchain. #25628
Copy link
Copy link
Closed
Closed
Copy link
Description
System Information
OpenCV version: main branch
OS: Arch Linux
Interpreter: Node v22.2.0
Wasm2js version: wasm2js version 117 (version_117-9-g2ca963835) (key point I think)
Detailed description
Following the guide "Build OpenCV.js"
$ emsdk update
$ emsdk install latest
$ emsdk activate latest
$ . /usr/lib/emsdk/emsdk_env.fish Result (with french local, sorry):
[...]
[100%] Linking CXX executable ../../bin/opencv_js.js
cd /home/ache/git/opencv/build_js/modules/js && /usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_js.dir/link.txt --verbose=1
/usr/lib/emsdk/upstream/emscripten/em++ -s SINGLE_FILE=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS="['_malloc', '_free']" -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -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 -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -Wl,--gc-sections --memory-init-file 0 -s TOTAL_MEMORY=128MB -s WASM_MEM_MAX=1GB -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s EXPORT_NAME="'cv'" -s DEMANGLE_SUPPORT=1 -s FORCE_FILESYSTEM=1 --use-preload-plugins --bind --post-js /home/ache/git/opencv/ocv/modules/js/src/helpers.js -Wno-missing-prototypes @CMakeFiles/opencv_js.dir/objects1.rsp -o ../../bin/opencv_js.js @CMakeFiles/opencv_js.dir/linkLibs.rsp
em++: error: --memory-init-file is no longer supported
make[3]: *** [modules/js/CMakeFiles/opencv_js.dir/build.make:117: bin/opencv_js.js] Error 1
make[3] : on quitte le répertoire « /home/ache/git/opencv/build_js »
make[2]: *** [CMakeFiles/Makefile2:1795: modules/js/CMakeFiles/opencv_js.dir/all] Error 2
make[2] : on quitte le répertoire « /home/ache/git/opencv/build_js »
make[1]: *** [CMakeFiles/Makefile2:1828: modules/js/CMakeFiles/opencv.js.dir/rule] Error 2
make[1] : on quitte le répertoire « /home/ache/git/opencv/build_js »
make: *** [Makefile:524: opencv.js] Error 2
Traceback (most recent call last):
File "/home/ache/git/opencv/./ocv/platforms/js/build_js.py", line 304, in <module>
builder.build_opencvjs()
File "/home/ache/git/opencv/./ocv/platforms/js/build_js.py", line 207, in build_opencvjs
execute(["make", "-j", str(multiprocessing.cpu_count()), "opencv.js"])
File "/home/ache/git/opencv/./ocv/platforms/js/build_js.py", line 23, in execute
raise Fail("Child returned: %s" % retcode)
Fail: Child returned: 2
emcmake: error: 'python ./ocv/platforms/js/build_js.py build_js -DCMAKE_TOOLCHAIN_FILE=/usr/lib/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/lib/emsdk/node/16.20.0_64bit/bin/node' failed (returned 1)Main error: em++: error: --memory-init-file is no longer supported.
And in fact: from the emscripten main repo, a commit drops the support of that option.
It doesn't seems to be useful, since sWASM=0 wasn't used. I think it can be deleted.
Steps to reproduce
The steps are the one describe in the guide and listed up there.
https://docs.opencv.org/3.4/d4/da1/tutorial_js_setup.html
Issue submission checklist
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I report the issue, it's not a question
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable