I want to install the latest emscripten in ubuntu for playing with WebAssembly using the following command.
sudo apt-get install emscripten But it gives me the version 1.22.1 which is a version in 2014 and do not support WebAssembly compiling.
$ emcc --version emcc (Emscripten GCC-like replacement) 1.22.1 () Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt) This is free and open source software under the MIT license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Are there a simple guide for installing the latest emscripten in command line?
3 Answers
The installation instructions suggest: download emsdk-portable.tar.gz
Unzip it, then open a terminal and run:
# Fetch the latest registry of available tools. ./emsdk update # Download and install the latest SDK tools. ./emsdk install latest # Make the "latest" SDK "active" ./emsdk activate latest 1It is not enough to build a newer version of emscripten. You will also have to build LLVM yourself, as emscripten will complain about
CRITICAL:root:WebAssembly set as target, but LLVM has not been built with the WebAssembly backend I got it running by following the tutorial on building LLVM at and some hints from
git clone git -C llvm/tools clone git -C llvm/projects clone git -C llvm/projects clone git -C llvm/projects clone git -C llvm/projects clone mkdir llvmbuild cd llvmbuild cmake -G "Unix Makefiles" \ -DLLVM_ENABLE_PROJECTS="llvm/tools/clang;llvm/projects/libcxx;llvm/projects/libcxxabi" \ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \ -DCMAKE_BUILD_TYPE=Release \ ../llvm make all cd .. And then following the tutorial on building emscripten at
git clone cd emsdk ./emsdk install sdk-incoming-64bit binaryen-master-64bit ./emsdk activate sdk-incoming-64bit binaryen-master-64bit source ./emsdk_env.sh cd .. # configure emscripten to use self-built LLVM cat ~/.emscripten \ | sed "s:LLVM_ROOT=[^\n]*:LLVM_ROOT='${PWD}/llvmbuild/bin':g" \ > ~/.emscripten.tmp mv ~/.emscripten ~/.emscripten.bak mv ~/.emscripten.tmp ~/.emscripten 1From the emscripten's doc page [ from the ground zero ]
1. Get the emsdk repo
git clone 2. Enter that directory
cd emsdk 3. Download and install the latest SDK tools
./emsdk install latest 4. Make the "latest" SDK "active"
./emsdk activate latest 5. Activate PATH and other environment variables
source ./emsdk_env.sh these variables are set for the current terminal, if you want to make it for everybody, so you can put into any terminal profile. Here they are:
The environment variables:
EMSDK = < path to emsdk dir >
EM_CONFIG = ~/.emscripten
EMSDK_NODE = < path to emsdk dir >/node/12.9.1_64bit/bin/node
6. Now just try it!
emcc