Skip to content

Getting Started on Ubuntu 12.10

juj edited this page Mar 1, 2013 · 2 revisions

This guide instructs step-by-step on how to setup emscripten on a clean Ubuntu 12.10 installation. With little to no modifications, they'll likely work for other distros as well (mostly depending on the package manager used).

  1. Install prerequisite software:
  • sudo apt-get install git subversion cmake build-essential default-jre
  • If you want to use scons with emscripten, and/or successfully run the test other.test_scons, also run sudo apt-get install scons
  1. Build LLVM+Clang 3.2 from SVN repository:

After these steps, Clang 3.2 will be built into ~/llvm32build/bin. The source tree ~/llvm32 is not needed anymore, if you want to conserve disk space.

  1. Set up Clang 3.2 in PATH:
  • cd ~

  • echo "export PATH=~/llvm32build/bin:$PATH" >> .bashrc

    The above change is permanent and it persists between system restarts. It only affects the current user.

  1. Close all terminal windows, and open a new one. Check that clang works ok in path:
  • cd ~

  • clang --version

    The command should output: clang version 3.2 (tags/RELEASE_32/final 170916) Target: i386-pc-linux-gnu Thread model: posix

  1. Delete old .emscripten file if it happened to exist:
  • rm ~/.emscripten
  • rm -rf ~/.emscripten_cache
  1. Set up node.js:
  1. Obtain emscripten:
  • cd ~

  • git clone https://github.com/kripken/emscripten.git

    By default, git will clone the emscripten 'incoming' branch, which is the branch where the newest developments of emscripten occur. If you want to use a more stable branch, switch to the 'master' branch:

  • cd ~/emscripten

  • git checkout master

  1. Perform emscripten "first run":
  • cd ~/emscripten
  • ./emcc --help
  • edit the file ~/.emscripten in a text editor to set up any required paths.
  1. (Optional) Compile a simple test program to check that everything works:
  • cd ~/emscripten

  • ./em++ tests/hello_world.cpp

  • node a.out.js

    Running node should output: hello, world!

  1. (Optional) Compile a simple WebGL program to check that .html output and GLES2/WebGL works:
  • cd ~/emscripten

  • ./emcc tests/hello_world_gles.c -o hello_world_gles.html

    Open the produced .html file in Firefox or Chrome to test that WebGL acceleration works.

  1. (Optional) Run the full battery of tests to check that emscripten is perfectly operational on the current platform: