1

I am trying to run a docker image with the following command:

docker run -v $PWD/build:/app/build --rm tflite-find-arena-size

However this error pops up to me. I am using MacOS. I tried brew install it but that didn't help. I also opened ~/.emscripten file and checked that BINARYEN_ROOT is not empty. Please help.

shared:ERROR: BINARYEN_ROOT is set to empty value in /root/.emscripten
Makefile.emcc:31: recipe for target 'build' failed
make: *** [build] Error 1

This is the makefile that I am using:

NAME = find-arena-size

CC = emcc
CXX = em++
CFLAGS ?= -Wall

MACROS += -DTF_LITE_DISABLE_X86_NEON
CXXFLAGS += -std=c++11
EMCCFLAGS += -s WASM=0
EMCCFLAGS += --bind
CFLAGS += -I.
CFLAGS += -Isource
CFLAGS += -Iedge-impulse-sdk/
CFLAGS += -Iedge-impulse-sdk/tensorflow
CFLAGS += -Iedge-impulse-sdk/third_party
CFLAGS += -Iedge-impulse-sdk/third_party/flatbuffers
CFLAGS += -Iedge-impulse-sdk/third_party/flatbuffers/include
CFLAGS += -Iedge-impulse-sdk/third_party/flatbuffers/include/flatbuffers
CFLAGS += -Iedge-impulse-sdk/third_party/gemmlowp/
CFLAGS += -Iedge-impulse-sdk/third_party/gemmlowp/fixedpoint
CFLAGS += -Iedge-impulse-sdk/third_party/gemmlowp/internal
CFLAGS += -Iedge-impulse-sdk/third_party/ruy
CFLAGS += -Imodel-parameters
CFLAGS += -Iedge-impulse-sdk/porting

all: build

.PHONY: build clean

build:
    echo "Mazenm"
    mkdir -p build/emcc
    $(CC) -c $(MACROS) $(CFLAGS) $(LFLAGS) edge-impulse-sdk/tensorflow/lite/c/common.c -o build/emcc/common.o
    $(CXX) $(MACROS) $(CXXFLAGS) $(CFLAGS) $(LFLAGS) $(EMCCFLAGS) emcc/emcc_binding.cpp edge-impulse-sdk/tensorflow/lite/kernels/*.cc edge-impulse-sdk/tensorflow/lite/kernels/internal/*.cc edge-impulse-sdk/tensorflow/lite/micro/kernels/*.cc edge-impulse-sdk/tensorflow/lite/micro/*.cc edge-impulse-sdk/tensorflow/lite/micro/memory_planner/*.cc edge-impulse-sdk/tensorflow/lite/core/api/*.cc ./edge-impulse-sdk/dsp/memory.cpp emcc/porting/*.c* build/emcc/common.o -o build/emcc/$(NAME).js
    rm build/emcc/*.o

clean:
    rm -r build/emcc
Maz jass
  • 11
  • 2

2 Answers2

0

Which docker image are you using? How did you install emscripten (emsdk?) within the docker image.

There is a semi-official docker image you can use via docker pull emscripten/emsdk.

However you should be able to install the emsdk directly on MacOS without needing to use docker at all. This is the recommended way to install emscripten. If you have problems with installing the emsdk directly please file a bug at https://github.com/emscripten-core/emsdk

sbc100
  • 2,619
  • 14
  • 11
  • I am using the docker image in this repo (in the web assembly section) https://github.com/edgeimpulse/tflite-find-arena-size, when I run it the error arises. – Maz jass Jul 01 '20 at 20:58
  • Ah, you need to run `emsdk_env.sh` in the shell, not just add to PATH. So rather than `RUN echo "PATH=$PATH:/app/emsdk:/app/emsdk/node/12.9.1_64bit/bin:/app/emsdk/upstream/emscripten" > ~/.bashrc` you should run something like `RUN source app/emsdk/emsdk_env.sh > ~/.bashrc` – sbc100 Jul 03 '20 at 19:35
  • 1
    When I run `source emsdk/emsdk_env.sh > ~/.bashrc` then run `docker run -v $PWD/build:/app/build --rm tflite-find-arena-size` I get the same error which is `shared:ERROR: BINARYEN_ROOT is set to empty value in /root/.emscripten` – Maz jass Jul 08 '20 at 14:37
0

It's looks like emsdk is not activated. Mabe path to emsdk is not correct.