Anderson Green
Anderson Green

Reputation: 31810

Installing Emscripten on Ubuntu

I am trying to install Emscripten on Ubuntu, but the official installation guide for Emscripten doesn't offer any instructions for installing Emscripten on Linux. The only advice that the installation guide has to offer is:

If you are on Linux, things should be very simple for you and there is no need for any additional guide.

I have read the README.md file in the Emscripten repository as well, and it doesn't offer any instructions for Ubuntu either. What steps will I need to follow in order to set up Emscripten on Ubuntu?

Upvotes: 11

Views: 9949

Answers (3)

Brent Bradburn
Brent Bradburn

Reputation: 54879

Emscripten is a complex system of software tools with support for multiple platforms. As is typical for such systems, the getting-started instructions can be a bit cryptic. A first sad note is that just installing emscripten from the Ubuntu repos probably isn't your best bet, at least for now.

I got much of what I needed by downloading Portable Emscripten SDK for Linux and OS X, and following these steps from the included README.md file:

  • Run ./emsdk update. This will fetch the latest registry of available tools.
  • Run ./emsdk install latest. This will download and install the latest SDK tools.
  • Run ./emsdk activate latest. This will set up ~/.emscripten to point to the SDK.

Note that the initial download is tiny, but running the steps above takes a while (on the order of an hour, but probably depends on Internet speeds) and uses about 13G of disk space.

I found that I also needed to install (on Ubuntu 14.04 LTS):

apt-get install nodejs-legacy

There may be other dependencies required, which will hopefully be easy to track down based on the error messages that you see.

Here's a simple example of how you might build and run a C++ program:

emsdk_portable/emscripten/tag-1.34.8/em++ hello.cpp -o temp.html
chromium-browser --new-window temp.html

Upvotes: 3

abergmeier
abergmeier

Reputation: 14052

For getting started with clang 3.2 I assume you are running Ubuntu 12.10. 13.04 already has clang 3.2 packaged, so I would recommend using these package(s).

There are two ways of getting them:

  1. Installing/Upgrading selected packages of Ubuntu 13.04 (minor intrusive)

    • Add deb http://archive.ubuntu.com/ubuntu/ raring main restricted universe multiverse to your sources.
    • Update your package info (e.g. sudo apt-get update)
    • Install only the needed package and dependencies (e.g. sudo apt-get install clang-3.2)
    • Disable the source entry, added before.
  2. Upgrade/Install Ubuntu to 13.04+

EDIT:

Update to current situation.

Upvotes: 7

dustin.b
dustin.b

Reputation: 1275

For Ubuntu 12.04 it is also very easy.

  1. go to http://llvm.org/releases/download.html and download LLVM 3.2 (Clang Binaries for Ubuntu-12.04/x86) LLVM is integrated
  2. extract it to a place you like eg. ~/opt/dev/llvm
  3. add this to your .profile PATH="$PATH:/home/[your_profile]/opt/dev/llvm/clang3.2/bin"
  4. make sure you have nodejs installed
  5. follow the instructions for the emscripten installation

thats all

if you get /usr/include/features.h:324:10: fatal error: 'bits/predefs.h' file not found simply install sudo apt-get install libc6-dev-i386

Upvotes: 8

Related Questions