This looks very similar to the issue reported here: https://github.com/kripken/emscripten/issues/1432
Trouble with emscripten setup
-
24-06-2022 - |
Question
I'm trying to setup emscripten. So, I followed this instructions.
To use Emscripten and complete this tutorial, you need a few things:
The Emscripten code, from github (git clone git://github.com/kripken/emscripten.git. The master branch is fine, it is guaranteed to always be stable. We merge to master only after all tests pass.)
LLVM with Clang. Version 3.2 is the officially supported version, others may not work. There are official clang binaries that include LLVM for some platforms, if yours is not there then you should get the LLVM and Clang sources and build them.
Node.js (0.8 or above)
Python 2.7.3
I checked versions by this lines:
node --version
-> v0.10.15
python --version
-> Python 2.7.3
I had no LLVM and Clang installed. So, I install them by this way:
sudo add-apt-repository ppa:kxstudio-team/builds
sudo apt-get update
sudo apt-get install llvm clang
then, I'm checking their versions:
llvm-config --version
-> 3.2
clang --version
->
Ubuntu clang version 3.2-1~exp9ubuntu1~precise1 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: i386-pc-linux-gnu
Thread model: posix
Next, I'm downloading emscripten by this command:
git clone git://github.com/kripken/emscripten.git ~/emscripten
(as follows in tutorial)
Entering emscripten directory: cd ~/emscripten
Also, I followed this:
Before continuing, it's a good idea to make sure the requirements work. Try
clang tests/hello_world.cpp
./a.out
(Add the path to clang if it isn't installed systemwide.) That uses Clang and LLVM to compile a "hello world" app and run it. The second command there should print "hello, world!". Then, test Node.js with
node tests/hello_world.js
which should also print out "hello, world!". (As before, add the path to node if it isn't installed systemwide.)
Outputs are hello, world!
in both commands.
Next, first launching emcc:
./emcc
(as follows in tutorial)
Outputs:
==============================================================================
Welcome to Emscripten!
This is the first time any of the Emscripten tools has been run.
A settings file has been copied to ~/.emscripten, at absolute path: /home/<my-user-name>/.emscripten
It contains our best guesses for the important paths, which are:
LLVM_ROOT = /usr/bin
PYTHON = /usr/bin/python2
NODE_JS = /usr/bin/node
EMSCRIPTEN_ROOT = /home/<my-user-name>/emscripten
Please edit the file if any of those are incorrect.
This command will now exit. When you are done editing those paths, re-run it.
==============================================================================
Checking those paths to make sure they are correct:
/usr/bin/python2 --version
-> Python 2.7.3
/usr/bin/node --version
-> v0.10.15
/usr/bin/llvm-config --version
-> 3.2
It looks ok. Now I'm gonna try to compile examples from tutorial:
Building example 1:
./emcc tests/hello_world.cpp
Outputs: '' (nothing) Running example 1:
node a.out.js
Outputs: hello, world!
Building example 2 (Generating HTML):
./emcc tests/hello_world_sdl.cpp -o hello.html
Outputs:
Traceback (most recent call last):
File "./emcc", line 1428, in <module>
libfile = shared.Cache.get(name, create)
File "/home/<my-user-name>/emscripten/tools/cache.py", line 37, in get
shutil.copyfile(creator(), cachename)
File "./emcc", line 1234, in create_libc
return build_libc('libc.bc', libc_files)
File "./emcc", line 1204, in build_libc
shared.Building.link(o_s, in_temp(lib_filename))
File "/home/<my-user-name>/emscripten/tools/shared.py", line 891, in link
if Building.is_bitcode(f):
File "/home/<my-user-name>/emscripten/tools/shared.py", line 1272, in is_bitcode
b = open(filename, 'r').read(4)
IOError: [Errno 2] No such file or directory: '/tmp/tmphG0_UZ/dlmalloc.c.o'
No 'hello.html' created! What I'm doing wrong?
Additional information:
uname -a
Linux <name-of-my-system> 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 athlon i386 GNU/Linux
I searched this on Google but their solutions are not helping me. (more different errors and more pain)
Solution