emscripten-docker icon indicating copy to clipboard operation
emscripten-docker copied to clipboard

Make it easier to use emscripten tools

Open olilarkin opened this issue 4 years ago • 1 comments

i need to be able to call file_packager.py directly, but EMSDK env var doesn't seem to be set in the docker image as it would be with a direct install.

sorry to post a query like this here, but how is it possible to call file_packager.py

ideally something like this would just work in the docker image

python $EMSDK/upstream/emscripten/tools/file_packager.py

but "upstream" is variable depending on the tag and as mentioned EMSDK is not set

olilarkin avatar Feb 29 '20 01:02 olilarkin

Hi! Can you please tell me which image do you use? All images have $EMSDK variable being set.

> docker run --rm -it trzeci/emscripten:1.39.16-fastcomp bash -c 'echo $EMSDK'
/emsdk_portable

> docker run --rm -it trzeci/emscripten:1.39.16-upstream bash -c 'echo $EMSDK'
/emsdk_portable

And:

> docker run --rm -it trzeci/emscripten:1.39.16-upstream bash -c ' $EMSDK/upstream/emscripten/tools/file_packager.py --help'
Remember to build the main file with  -s FORCE_FILESYSTEM=1  so that it includes support for loading this file package
Nothing to do!

Just a sanity check: There is a difference between single quote:

docker run --rm -it trzeci/emscripten:1.39.16-upstream bash -c 'echo $EMSDK'

and double quote:

docker run --rm -it trzeci/emscripten:1.39.16-upstream bash -c "echo $EMSDK"

In case of double quote - the bash interpreter resolves variable before executing the command - effectively it will look for $EMSDK on the host machine, so effectively it will be the same like:

docker run --rm -it trzeci/emscripten:1.39.16-upstream echo $EMSDK

In case of single quote - the string is not interpolated and passed in a raw form to the bash interpreter inside the docker image, and there it will be evaluated - effectively $EMSDK will be resolved to the correct value.

trzecieu avatar Jun 06 '20 23:06 trzecieu