7

Following this tutorial, I tried to compile a C program to WebAssembly by using the following command.

emcc hello.c -s WASM=1 -o hello.html

But I ecounter the "No available targets are compatible with this triple." problem.

$ emcc hello.c -s WASM=1 -o hello.html
WARNING  root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO     root: (Emscripten: Running sanity checks)
WARNING  root: Assigning a non-existent settings attribute "WASM"
WARNING  root:  - did you mean one of ASM_JS?
WARNING  root:  - perhaps a typo in emcc's  -s X=Y  notation?
WARNING  root:  - (see src/settings.js for valid values)
/home/casper/Desktop/test/emsdk/clang/fastcomp/build_incoming_64/bin/lli: error creating EE: No available targets are compatible with this triple.
FAIL: Running the generated program failed!

How to solve it?



EMCC Version

$ 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.


Basic Information

OS           : Ubuntu 16.10
emcc Location: /usr/bin/emcc


2
  • 2
    Looks like perhaps your emscripten version is wrong. Where is your emcc coming from (which emcc)? It seems to be claiming that WASM is not in setting.js which means perhaps its old version? Commented Mar 9, 2017 at 20:34
  • 1
    The emcc installed is emcc (Emscripten GCC-like replacement) 1.22.1. Commented Mar 10, 2017 at 3:43

1 Answer 1

3

You're running emcc version 1.22.1 which dates back from 8/7/2014, before WebAssembly was started.

emsdk in the instruction you followed must have installed a very recent emscripten version (this is what sdk-incoming-64bit from these instructions does: incoming is the latest branch), but an older emscripten is found in your system.

Run:

which emcc
echo $PATH

What do they say? I suspect you have an old emscripten lying in there. You probably also want to check and/or delete your ~/.emscripten file which may also contain obsolete information.

You can alter your path, delete the older emscripten, or invoke the SDK's emscripten using its absolute path (though this may fail later if other scripts pick up older versions along the path).

Don't forget (from the tutorial's instructions) to activate the SDK you've installed:

./emsdk activate --build=Release sdk-incoming-64bit binaryen-master-64bit

And run:

source ./emsdk_env.sh

This last command needs to be run for every shell session. If you open a new shell you need to re-source then SDK.

Sign up to request clarification or add additional context in comments.

5 Comments

When I execute which emcc, it shows me /usr/bin/emcc.
@Casper I added a bit more info to the answer. Make sure you've run activate, and source. If that doesn't work, delete /usr/bin/emcc and try activate / source again. Make sure to check which emcc.
Before I compile the Emscripten from source, I have installed the Emscripten from APT by using command sudo apt-get install emscripten. The emcc 1.22.1 should be from APT.
@Casper that's the problem then: the APT emcc is in your shell's $PATH before the SDK's emcc. Does running source ./emsdk_env.sh fix the issue for that terminal session?
After running source ./emsdk_env.sh, I can run emcc and emrun by using the full paths of them in the command line instead of just emcc and emrun.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.