构建 OpenCV.js 失败。CMake 找不到已安装的编译器?

Mak*_*gan 5 javascript opencv computer-vision web

我有以下目录结构:

~/emsdk
~/opencv
Run Code Online (Sandbox Code Playgroud)

我正在尝试构建 OpenCV.js

我愿意

cd ~/opencv
python ./platforms/js/build_js.py build_js --emscripten_dir=~/emsdk/
Run Code Online (Sandbox Code Playgroud)

结果是:

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
Run Code Online (Sandbox Code Playgroud)

系统中同时安装了 gcc 和 g++。在运行此命令之前,我转到 ~/emsdk 并运行:

./emsdk update
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会失败。我正在尝试遵循此[教程][1]。

编辑:

我正在 Ubuntu 上做这个,如果有帮助的话

编辑2:

问题的一个重要部分似乎来自以下消息:

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

没有emsdk/cmake目录。

编辑3:

发布答案,这就是路径

Mak*_*gan 5

问题是我的一个愚蠢的假设。写作:

python ./platforms/js/build_js.py build_js --emscripten_dir=~/emsdk/
Run Code Online (Sandbox Code Playgroud)

是错误的命令,正确的是:

python ./platforms/js/build_js.py build_js --emscripten_dir=/home/username/emsdk/emscripten/1.38.30/
Run Code Online (Sandbox Code Playgroud)

  • 对我来说,我可以这样做:`python ./platforms/js/build_js.py build_js --emscripten_dir ~/Documents/dev/emsdk/upstream/emscripten/;` (5认同)