1

我正在尝试设置 emscripten。所以,我遵循了这个指示。

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->Python 2.7.3

/usr/bin/node --version->v0.10.15

/usr/bin/llvm-config --version->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

我在谷歌上搜索了这个,但他们的解决方案对我没有帮助。(更多不同的错误和更多的痛苦)

4

1 回答 1

0

这看起来与此处报告的问题非常相似: https ://github.com/kripken/emscripten/issues/1432

于 2013-08-15T09:36:53.720 回答