Building opencv.js on MAC fails undefined symbol: __tls_base
I am having trouble building opencv for js using Emscripten. I am using a MAC with the following installed:
Mac OS 10.15.5 Emscripten 2.0.6 INSTALLED Python 3.8.5 cmake version 3.16.2 git clone https://github.com/opencv/opencv.git ### cloned 2020-10-06
When I try to build opencv.js the complie steps all complete without error until the final step which reports:
error: undefined symbol: tis_base
The detail of the error report is shown below. Any suggestions on how to build this on a MAC would be most welcome.
Thank you.
Below is the detail of the build process: python platforms/js/build_js.py build_js ... ...
[100%] Linking CXX executable ../../bin/opencv_js.js
cd /Users/Chris/Documents/myOpenCV-2020-10/opencv/build_js/modules/js && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/opencv_js.dir/link.txt --verbose=1
/Users/Chris/Documents/emsdk/emsdk/upstream/emscripten/em++ -s USE_PTHREADS=0 -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 -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -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 -DNDEBUG -O2 -DNDEBUG -Wl,--gc-sections -O2 --memory-init-file 0 -s TOTAL_MEMORY=128MB -s WASM_MEM_MAX=1GB -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s SINGLE_FILE=1 -s EXPORT_NAME="'cv'" -s DEMANGLE_SUPPORT=1 -s FORCE_FILESYSTEM=1 --use-preload-plugins --bind --post-js /Users/Chris/Documents/myOpenCV-2020-10/opencv/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
error: undefined symbol: __tls_base (referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: ___tls_base may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
em++: error: '/Users/Chris/Documents/emsdk/emsdk/node/12.18.1_64bit/bin/node /Users/Chris/Documents/emsdk/emsdk/upstream/emscripten/src/compiler.js /var/folders/kt/_3szkn_s2cjf7dr0m1n8qh8c0000gr/T/tmpo3ly7v0q.txt' failed (1)
make[3]: *** [bin/opencv_js.js] Error 1
make[2]: *** [modules/js/CMakeFiles/opencv_js.dir/all] Error 2
make[1]: *** [modules/js/CMakeFiles/opencv.js.dir/rule] Error 2
make: *** [opencv.js] Error 2
Traceback (most recent call last):
File "platforms/js/build_js.py", line 277, in <module>
builder.build_opencvjs()
File "platforms/js/build_js.py", line 195, in build_opencvjs
execute(["make", "-j", str(multiprocessing.cpu_count()), "opencv.js"])
File "platforms/js/build_js.py", line 23, in execute
raise Fail("Child returned: %s" % retcode)
__main__.Fgit clone https://github.com/opencv/opencv.git