Skip to content
Advertisement

Building OpenCV.js fails. CMake can’t find installed compilers?

I have the following directory structure:

~/emsdk
~/opencv

I am trying to build OpenCV.js

I do

cd ~/opencv
python ./platforms/js/build_js.py build_js --emscripten_dir=~/emsdk/

Which results in:

CMake Error at /usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:100 (message):
  Could not find toolchain file:
  ~/emsdk/cmake/Modules/Platform/Emscripten.cmake
Call Stack (most recent call first):
  CMakeLists.txt:135 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
  File "./platforms/js/build_js.py", line 227, in <module>
    builder.config()
  File "./platforms/js/build_js.py", line 167, in config
    execute(cmd)
  File "./platforms/js/build_js.py", line 23, in execute
    raise Fail("Child returned: %s" % retcode)
__main__.Fail: Child returned: 1

Both gcc and g++ are installed in the system. Prior of running this I went to ~/emsdk and ran:

./emsdk update
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh

I am not sure why this is failing. I am trying to follow this [tutorial][1].

EDIT:

I am doing this on Ubuntu, if it helps

EDIT 2:

It seems an important part of the problem comes from the message:

 CMake Error at /usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:100 (message):
      Could not find toolchain file:
      ~/emsdk/cmake/Modules/Platform/Emscripten.cmake

There is no emsdk/cmake directory.

EDIT 3:

Posting answer, it was the path

Advertisement

Answer

The problem is a stupid assumption on my end. Writing:

python ./platforms/js/build_js.py build_js --emscripten_dir=~/emsdk/

Is the wrong command, the correct one is:

python ./platforms/js/build_js.py build_js --emscripten_dir=/home/username/emsdk/emscripten/1.38.30/
Advertisement