"emcc" command does not recognized

7.6k views Asked by At

I'm having issue with building this demo. https://github.com/kakukogou/opencvjs_demo_segmentation

When i cd into this folder and run make command i get this error message:

/bin/sh: 1: emcc: not found  
make: *** [segmentation] Error 127

This is how make file looks like.

segmentation: ../src/segmentation.cpp ../src/export.cpp  
    mkdir -p $(OBJDIR)  
    emcc \  
    ../src/segmentation.cpp \  
    ../src/export.cpp \  
    -I $(OPENCV_INSTALL_DIR)/include \  
    $(OPENCV_INSTALL_DIR)/lib/libopencv_core.so \   
    $(OPENCV_INSTALL_DIR)/lib/libopencv_imgproc.so \  
    -s EXPORTED_FUNCTIONS="['_on_mouse', '_on_init', '_on_process']" \  
    -O3 \  
    --llvm-lto 1 \  
    --closure 1 \  
    -s PRECISE_F32=1 \  
    -s FORCE_ALIGNED_MEMORY=1 \  
    -s TOTAL_MEMORY=306777216 \  
    -o ./bin/segmentation.js  

clean:  
    rm ./bin/*.js ./bin/*.mem  

Is there any issue with my environment variables. What is the proper way to compile this ?

5

There are 5 answers

0
HarshaXsoad On BEST ANSWER

For whatever reason default path configurations in .emscripten does not enable emcc in terminal. so i manually set the EMSCRIPTEN_ROOT in /etc/environment and now it recognizes the emcc command in terminal.

1
A Y A N On

this works for me
adding
source ./emsdk_env.sh to .bashrc or .zshrc file

0
Yasin Amini On

You have to make the environment manually, try this

source /emsdk/emsdk_env.sh
0
Grégoire Motot On

For Windows, in 'emsdk' folder (downloaded from ' git clone https://github.com/emscripten-core/emsdk.git ') run :

./emsdk activate latest --permanent
0
GAURAV On

Encounter same problem in window 11

In my case there was problem with path of EMSDK

After running emsdk_env.bat

I have check path in environment variable and I found it was E:/emsdk

Then I have changed it to E:\emsdk

Now working fine for me