emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.74k stars 3.3k forks source link

sudo: emcmake: command not found #13700

Open MarkKocherovsky opened 3 years ago

MarkKocherovsky commented 3 years ago

I am trying to install opencv js using the instructions in this link. I've followed the emscripten sdk instructions given here, and am trying to run emcmake python ./opencv/platforms/js/build_js.py build_js. This returns the following error:

configure: python ./opencv/platforms/js/build_js.py build_js
Args: Namespace(build_dir='build_js', build_doc=False, build_flags=None, build_loader=False, build_perf=False, build_test=False, build_wasm=False, build_wasm_intrin_test=False, clean_build_dir=False, cmake_option=None, config='/home/mkocherov/opencv/platforms/js/opencv_js.config.py', config_only=False, disable_wasm=False, emscripten_dir='/home/mkocherov/emsdk/upstream/emscripten', enable_exception=False, opencv_dir='/home/mkocherov/opencv', simd=False, skip_config=False, threads=False)

Check dir /home/mkocherov/build_js (create: True, clean: False)
Check dir /home/mkocherov/opencv (create: False, clean: False)
Check dir /home/mkocherov/emsdk/upstream/emscripten (create: False, clean: False)
=====
===== Config OpenCV.js build for default target
=====
Executing: ['cmake', '-DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python', '-DENABLE_PIC=FALSE', '-DCMAKE_BUILD_TYPE=Release', "-DCMAKE_TOOLCHAIN_FILE='/home/mkocherov/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake'", "-DCPU_BASELINE=''", "-DCPU_DISPATCH=''", '-DCV_TRACE=OFF', '-DBUILD_SHARED_LIBS=OFF', '-DWITH_1394=OFF', '-DWITH_ADE=OFF', '-DWITH_VTK=OFF', '-DWITH_EIGEN=OFF', '-DWITH_FFMPEG=OFF', '-DWITH_GSTREAMER=OFF', '-DWITH_GTK=OFF', '-DWITH_GTK_2_X=OFF', '-DWITH_IPP=OFF', '-DWITH_JASPER=OFF', '-DWITH_JPEG=OFF', '-DWITH_WEBP=OFF', '-DWITH_OPENEXR=OFF', '-DWITH_OPENGL=OFF', '-DWITH_OPENVX=OFF', '-DWITH_OPENNI=OFF', '-DWITH_OPENNI2=OFF', '-DWITH_PNG=OFF', '-DWITH_TBB=OFF', '-DWITH_TIFF=OFF', '-DWITH_V4L=OFF', '-DWITH_OPENCL=OFF', '-DWITH_OPENCL_SVM=OFF', '-DWITH_OPENCLAMDFFT=OFF', '-DWITH_OPENCLAMDBLAS=OFF', '-DWITH_GPHOTO2=OFF', '-DWITH_LAPACK=OFF', '-DWITH_ITT=OFF', '-DWITH_QUIRC=ON', '-DBUILD_ZLIB=ON', '-DBUILD_opencv_apps=OFF', '-DBUILD_opencv_calib3d=ON', '-DBUILD_opencv_dnn=ON', '-DBUILD_opencv_features2d=ON', '-DBUILD_opencv_flann=ON', '-DBUILD_opencv_gapi=OFF', '-DBUILD_opencv_ml=OFF', '-DBUILD_opencv_photo=ON', '-DBUILD_opencv_imgcodecs=OFF', '-DBUILD_opencv_shape=OFF', '-DBUILD_opencv_videoio=OFF', '-DBUILD_opencv_videostab=OFF', '-DBUILD_opencv_highgui=OFF', '-DBUILD_opencv_superres=OFF', '-DBUILD_opencv_stitching=OFF', '-DBUILD_opencv_java=OFF', '-DBUILD_opencv_js=ON', '-DBUILD_opencv_python2=OFF', '-DBUILD_opencv_python3=OFF', '-DBUILD_EXAMPLES=OFF', '-DBUILD_PACKAGE=OFF', '-DBUILD_TESTS=OFF', '-DBUILD_PERF_TESTS=OFF', '-DBUILD_DOCS=OFF', '-DWITH_PTHREADS_PF=OFF', '-DCV_ENABLE_INTRINSICS=OFF', '-DBUILD_WASM_INTRIN_TESTS=OFF', "-DCMAKE_C_FLAGS='-s USE_PTHREADS=0 '", "-DCMAKE_CXX_FLAGS='-s USE_PTHREADS=0 '", '/home/mkocherov/opencv']
Traceback (most recent call last):
    File "./opencv/platforms/js/build_js.py", line 279, in <module>
        builder.config()
    File "./opencv/platforms/js/build_js.py", line 192, in config
        execute(cmd)
    File "./opencv/platforms/js/build_js.py", line 25, in execute
        raise Fail("Execution failed: %d / %s" % (e.errno, e.strerror))
__main__.Fail: Execution failed: 13 / Permission denied 

However, running sudo emcmake python ./opencv/platforms/js/build_js.py build_js returns sudo: emcmake: command not found. I am using Windows 10 with the Ubuntu 20.04 terminal, and I have added the emcmake env variables to my PATH, which I have checked.

Semphriss commented 3 years ago

(Disclaimer: not an Emscripten maintainer)

Using sudo will create a new environment that will not inherit the variables set by source ./ensdk_env.sh. Instead, you may do sudo -s to open a full shell as root, then execute source ./ensdk_env.sh and then you may use the command as usual (without sudo, as you are already root).

I'm no expert, but you probably don't want to run commands as root needlessly as it increases the risk and possible damage if something goes wrong. Instead, you may want to see if the files in question should be chmod'ed to be readable (and, if necessary, writable) by other users.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.