我正在尝试设置emscripten。所以,我按照this说明进行操作。
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
我按这行检查了版本:
node --version
- > v0.10.15
python --version
- > Python 2.7.3
我没有安装LLVM和Clang。所以,我通过这种方式安装它们:
sudo add-apt-repository ppa:kxstudio-team/builds
sudo apt-get update
sudo apt-get install llvm clang
然后,我正在检查他们的版本:
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
接下来,我将通过此命令下载emscripten:
git clone git://github.com/kripken/emscripten.git ~/emscripten
(如教程中所示)
输入emscripten目录:cd ~/emscripten
另外,我跟着这个:
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.)
两个命令中的输出均为hello, world!
。
接下来,首先启动emcc:
./emcc
(如教程中所示)
输出:
==============================================================================
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.
==============================================================================
检查这些路径以确保它们是正确的:
/usr/bin/python2 --version
- &gt; Python 2.7.3
/usr/bin/node --version
- &gt; v0.10.15
/usr/bin/llvm-config --version
- &gt; 3.2
看起来不错。现在我将尝试编译教程中的示例:
构建示例1:
./emcc tests/hello_world.cpp
输出:''(没有) 运行示例1:
node a.out.js
输出:hello, world!
构建示例2(生成HTML):
./emcc tests/hello_world_sdl.cpp -o hello.html
输出:
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'
没有创建'hello.html'! 我做错了什么?
其他信息:
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
我在Google上搜索了这个,但他们的解决方案并没有帮助我。 (更多不同的错误和更多的痛苦)