emscripten-core/emscripten

How to install emsdk offline

Closed this issue · 2 comments

  1. I installed emsdk on my computer with an Internet connection.
    git clone https://github.com/emscripten-core/emsdk.git
    cd emsdk
    ./emsdk install latest
    ./emsdk activate latest
    source ./emsdk_env.sh
  2. Then compress the entire emsdk folder and place it on a computer without an Internet connection. After configuring ~/.bashrc.
    vim ~/.bashrc
    export PATH=/opt2/emsdk/emsdkV4.0.14:/opt2/emsdk/emsdkV4.0.14/upstream/emscripten:/opt2/emsdk/emsdkV4.0.14/node/22.16.0_64bit/bin:$PATH
    source ~/.bashrc
  3. when executing the code, a zlib error appears:rllib.error.URLError: <urlopen error [Errno 111] Connection refused>

it git clone from https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz, but I have been download it in the network environment, I can found it in the emsdk/upstream/emscripten/cache/ports zlib folder, but when run the demo in offline it downloaded again, seems to be related to the cache? How should I set up the cache?

juj commented

Try running python embuilder.py build -h on the internet connected system, to list all the system libraries that Emscripten is able to build.

You could e.g. run python embuilder.py build <target> for all targets you care about prepopulating into the cache.

Then you can set environment variable EMCC_FROZEN_CACHE=1 or the directive line FROZEN_CACHE = True in .emscripten config file to ensure that the cache is never disturbed on the users' offline computers.

I would just add: please use the embuilder launcher script (or embuilder.bat) on windows rather than running the .py file via python yourself.

I think we can close this as complete/answered.