我具有以下目录结构:
~/emsdk
~/opencv
我正在尝试构建OpenCV.js
我愿意
cd ~/opencv
python ./platforms/js/build_js.py build_js --emscripten_dir=~/emsdk/
这将导致:
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
系统中同时安装了gcc和g ++。 在运行此程序之前,我去了〜/ emsdk并运行:
./emsdk update
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
我不确定为什么会失败。我正在尝试遵循此[指南] [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
没有emsdk/cmake
目录。
编辑3:
发布答案,这就是路径
答案 0 :(得分:1)
在 MACOSX 上:
它有效:
python /path-to/opencv-src/platforms/js/build_js.py /path-to/build_js --emscripten_dir=/path-to/emsdk/upstream/emscripten
注意:
谢谢大家。
答案 1 :(得分:0)
问题是我的愚蠢假设。写作:
python ./platforms/js/build_js.py build_js --emscripten_dir=~/emsdk/
命令错误,正确的命令是:
python ./platforms/js/build_js.py build_js --emscripten_dir=/home/username/emsdk/emscripten/1.38.30/
答案 2 :(得分:0)
对我来说,这可行: python ./platforms/js/build_js.py build_js --emscripten_dir = / home /用户名/ emsdk / upstream / emscripten