forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started on Ubuntu 12.10
Mikhail Fedosov edited this page May 30, 2013
·
3 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).
- 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
- Build LLVM+Clang 3.2 from SVN repository:
cd ~
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_32/final llvm32
cd llvm32/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_32/final clang
cd ../..
mkdir llvm32build
cd llvm32build
cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm32
make
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.
- 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.
- 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
```
5. Delete old `.emscripten` file if it happened to exist:
```
rm ~/.emscripten
rm -rf ~/.emscripten_cache
```
6. Set up node.js:
- Follow instructions e.g. here: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
- Alternatively, manually download and install node.js from http://nodejs.org/
- Test that node works from command line: type `node --version` in terminal.
7. 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
```
8. Perform emscripten "first run":
```
cd ~/emscripten
./emcc --help
```
edit the file `~/.emscripten` in a text editor to set up any required paths.
9. (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!`
10. (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.
11. (Optional) Run the full battery of tests to check that emscripten is perfectly operational on the current platform:
```
cd ~/emscripten
python tests/runner.py
python tests/runner.py benchmark
```
Note that some tests will likely fail. Cross-reference the results with https://github.com/kripken/emscripten/issues?labels=tests to see if you are receiving currently unknown issues.