I cloned the repo from github on OS X.
➜ emscripten git:(master) ✗ ./em++
WARNING root: (Emscripten: system change: 1.25.0|asmjs-unknown-emscripten|/Users/dan/Applications/clang+llvm-3.5.0-macosx-apple-darwin/bin|3.5.0 vs 1.25.0|le32-unknown-nacl|/Users/dan/Applications/clang+llvm-3.5.0-macosx-apple-darwin/bin|3.5.0, clearing cache)
WARNING root: LLVM version appears incorrect (seeing "3.5.0", expected "3.3")
CRITICAL root: fastcomp in use, but LLVM has not been built with the JavaScript backend as a target, llc reports:
===========================================================================
LLVM (http://llvm.org/):
LLVM version 3.5.0
Optimized build.
Default target: x86_64-apple-darwin14.0.0
Host CPU: core-avx2
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_be - AArch64 (big endian)
arm - ARM
arm64 - AArch64 (little endian)
arm64_be - AArch64 (big endian)
armeb - ARM (big endian)
cpp - C++ backend
hexagon - Hexagon
mips - Mips
mips64 - Mips64 [experimental]
mips64el - Mips64el [experimental]
mipsel - Mipsel
msp430 - MSP430 [experimental]
nvptx - NVIDIA PTX 32-bit
nvptx64 - NVIDIA PTX 64-bit
ppc32 - PowerPC 32
ppc64 - PowerPC 64
ppc64le - PowerPC 64 LE
r600 - AMD GPUs HD2XXX-HD6XXX
sparc - Sparc
sparcv9 - Sparc V9
systemz - SystemZ
thumb - Thumb
thumbeb - Thumb (big endian)
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
xcore - XCore
===========================================================================
CRITICAL root: you can fall back to the older (pre-fastcomp) compiler core, although that is not recommended, see https://github.com/kripken/emscripten/wiki/LLVM-Backend
INFO root: (Emscripten: Running sanity checks)
CRITICAL root: failing sanity checks due to previous fast comp failure
So I tried to disable _Fastcomp_.
➜ emscripten git:(master) ✗ EMCC_FAST_COMPILER=0 ./em++
WARNING root: no input files
Compile something?
➜ emscripten git:(master) EMCC_FAST_COMPILER=0 ./em++ ../RegEx2DFA/src/RegEx2Dot.cpp
clang: warning: argument unused during compilation: '-nostdinc++'
/Users/dan/Documents/git/emscripten/src/compiler.js:330
if (err.indexOf('Aborting compilation due to previous errors') != -1) {
^
TypeError: Object TypeError: Cannot read property 'length' of undefined has no method 'indexOf'
at Object.<anonymous> (/Users/dan/Documents/git/emscripten/src/compiler.js:330:11)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Traceback (most recent call last):
File "/Users/dan/Documents/git/emscripten/emscripten.py", line 1578, in <module>
_main(environ=os.environ)
File "/Users/dan/Documents/git/emscripten/emscripten.py", line 1566, in _main
temp_files.run_and_clean(lambda: main(
File "/Users/dan/Documents/git/emscripten/tools/tempfiles.py", line 39, in run_and_clean
return func()
File "/Users/dan/Documents/git/emscripten/emscripten.py", line 1574, in <lambda>
DEBUG_CACHE=DEBUG_CACHE,
File "/Users/dan/Documents/git/emscripten/emscripten.py", line 1461, in main
jcache=jcache, temp_files=temp_files, DEBUG=DEBUG, DEBUG_CACHE=DEBUG_CACHE)
File "/Users/dan/Documents/git/emscripten/emscripten.py", line 185, in emscript
cwd=path_from_root('src'))
File "/Users/dan/Documents/git/emscripten/tools/jsrun.py", line 43, in run_js
raise Exception('Expected the command ' + str(command) + ' to finish with return code ' + str(assert_returncode) + ', but it returned with code ' + str(proc.returncode) + ' instead! Output: ' + str(ret)[:error_limit])
Exception: Expected the command ['/usr/local/bin/node', '/Users/dan/Documents/git/emscripten/src/compiler.js', '/tmp/tmpuaB_iw.txt', '/tmp/tmpgOKXAL.pre.ll', 'pre'] to finish with return code 0, but it returned with code 8 instead! Output: // Note: Some Emscripten settings will significantly limit the speed of the generated code.
// Note: Some Emscripten settings may limit the speed of the generated code.
Setting up Emscripten compiler is more involved than just cloning the Emscripten repository. The problem with your first attempt is that you used Apple-provided Clang with Emscripten, which is a different fork of LLVM and not supported. Emscripten uses its own fork of LLVM instead, since a part of the development occurs in the LLVM side. The problem with the second attempt is that the non-fastcomp mode of build only supports the upstream Clang release version 3.3, again Apple-provided fork of Clang is not appropriate.
See the Getting Started documentation at http://kripken.github.io/emscripten-site/docs/getting_started/index.html on how to obtain and set up Emscripten either via manual git cloning or via emsdk.
@juj Thank you for replying!
I was using the LLVM downloaded from http://llvm.org and I added LLVM_ROOT = '/Users/dan/Applications/clang+llvm-3.5.0-macosx-apple-darwin/bin' in ~/.emscripten. Is this version of LLVM available for Emscripten?
I got a network problem with the emsdk install method. (Have a problem with connection to AWS. Maybe due to GFW or something. I am in China.) But I can not find how to install via git cloning in the documentation.
The upstream LLVM 3.5 is not supported, because Emscripten uses its own fork of LLVM. The documentation to install via git cloning is here: http://kripken.github.io/emscripten-site/docs/building_from_source/building_fastcomp_manually_from_source.html .
@juj Just got Emscripten installed. I am exploring this magical compiler. Thank you so much!
Most helpful comment
Setting up Emscripten compiler is more involved than just cloning the Emscripten repository. The problem with your first attempt is that you used Apple-provided Clang with Emscripten, which is a different fork of LLVM and not supported. Emscripten uses its own fork of LLVM instead, since a part of the development occurs in the LLVM side. The problem with the second attempt is that the non-fastcomp mode of build only supports the upstream Clang release version 3.3, again Apple-provided fork of Clang is not appropriate.
See the Getting Started documentation at http://kripken.github.io/emscripten-site/docs/getting_started/index.html on how to obtain and set up Emscripten either via manual git cloning or via emsdk.