Can anybody generate opencv.js?

前端 未结 4 1413
情书的邮戳
情书的邮戳 2021-02-14 11:53

I can\'t generate OpenCV.js using this instructions: https://docs.opencv.org/master/d4/da1/tutorial_js_setup.html

I have this error:

CMake Error:

4条回答
  •  我在风中等你
    2021-02-14 12:30

    I'll just list out the parts where installation was slightly different from what was outlined in https://docs.opencv.org/master/d4/da1/tutorial_js_setup.html.

    For installing Binaryen, make sure you cd into the emsdk directory and then run these:

    ./emsdk install binaryen-master-64bit
    ./emsdk activate binaryen-master-64bit
    

    From the official docs,

    python ./platforms/js/build_js.py build_js
    

    doesn't work because you need to add an additional flag --emscripten_dir to specify where the correct path. Note that you want the folder below the emsdk root directory, typically /fastcomp/emscripten/ (for the older “fastcomp” compiler; for the newer upstream LLVM wasm backend it will be /upstream/emscripten/).

    I personally used the /upstream/emscripten one

    So run this:

    python /Users/fangran/opencv/platforms/js/build_js.py build_wasm --build_wasm --emscripten_dir /Users/fangran/emsdk/upstream/emscripten
    

    And it should work and return:

    =====
    ===== Build finished
    =====
    OpenCV.js location: /Users/fangran/opencv/build_wasm/bin/opencv.js
    

    For more details: refer to this link

提交回复
热议问题