EMScripten无法构建示例项目

时间:2012-04-28 01:17:58

标签: emscripten

我正在努力让EMScripten工作。我非常有信心我已经按照教程,并确保安装了所提到的依赖项。

在尝试构建示例项目时,它会像这样失败;

tv@apu:~/git/emscripten$ EMCC_DEBUG=1 ./emcc tests/hello_world.c 

emcc invocation:  ./emcc tests/hello_world.c 
emcc: compiling to bitcode
emcc: compiling source file:  tests/hello_world.c
emcc running: /usr/bin/clang -m32 -U__i386__ -U__x86_64__ -U__i386 -U__x86_64 -U__SSE__ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUNDING -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -U__STRICT_ANSI__ -U__CYGWIN__ -D__STDC__ -Xclang -triple=i386-pc-linux-gnu -nostdinc -nostdinc++ -Xclang -nobuiltininc -Xclang -nostdinc++ -Xclang -nostdsysteminc -Xclang -isystem/home/tv/git/emscripten/system/include -Xclang -isystem/home/tv/git/emscripten/system/include/bsd -Xclang -isystem/home/tv/git/emscripten/system/include/libc -Xclang -isystem/home/tv/git/emscripten/system/include/libcxx -Xclang -isystem/home/tv/git/emscripten/system/include/gfx -Xclang -isystem/home/tv/git/emscripten/system/include/net -Xclang -isystem/home/tv/git/emscripten/system/include/SDL -U__APPLE__ -emit-llvm -c tests/hello_world.c -o /tmp/tmpMvgQiE/hello_world_0.o
clang: warning: argument unused during compilation: '-nostdinc++'
emcc: will generate JavaScript
emcc: considering including libcxx: we need |[]| and have |[]|
emcc: considering including libcxxabi: we need |[]| and have |[]|
emcc: considering including dlmalloc: we need |[]| and have |[]|
emcc: saving intermediate processing steps to /tmp/emscripten_temp
emcc: LLVM dead globals elimination
Traceback (most recent call last):
  File "./emcc", line 837, in <module>
    shared.Building.llvm_opt(in_temp(target_basename + '.bc'), ['-internalize', '-globaldce'])
  File "/home/tv/git/emscripten/tools/shared.py", line 545, in llvm_opt
    output = Popen([LLVM_OPT, filename] + opts + ['-o=' + filename + '.opt.bc'], stdout=PIPE).communicate()[0]
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

~/.emscripten的内容:

tv@apu:~/git/emscripten$ cat ~/.emscripten | egrep -v '^#|^$'
EMSCRIPTEN_ROOT = os.path.expanduser('~/git/emscripten') # this helps projects using emscripten find it
LLVM_ROOT = os.path.expanduser('/usr/bin')
NODE_JS = 'node'
TEMP_DIR = '/tmp' # You will need to modify this on Windows
COMPILER_ENGINE = NODE_JS
JS_ENGINES = [NODE_JS]

我不知道问题是什么 - 需要帮助才能排除故障。有没有人对这可能有什么问题有任何想法?我错过了什么?

3 个答案:

答案 0 :(得分:0)

您是否尝试过最新的 Emscripten

好像您的LLVM_OPT不存在。如果问题仍然存在,请转到/home/tv/git/emscripten/tools/shared.py并在第545行(Popen([LLVM_OPT...)之前添加一行

print 'LLVM_OPT IS: <' + LLVM_OPT + '>'

在下一次编译中,这应该打印到{stoout LLVM_OPT的路径。这条路径可能不存在所以你可能只需要一个符号链接,因为opt二进制文件有一个版本附录或者这样的恶魔。

答案 1 :(得分:0)

看看你的路径。我正在与Emscripten合作,经过一系列令人困惑的失败后,我发现我的路径信息不正确。特别是我的LLVM_ROOT。这对我来说是正确的:

LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '/usr/lib/llvm-3.2/bin') # directory

请注意llvm的位置,它与我最初的默认/ usr / bin非常不同。请注意,即使路径错误,我建议的错误emscripten几乎正常工作。

注意:我使用的是Linux Mint 14(Ubuntu Quantal)。

答案 2 :(得分:0)

确保你的clang在符号链接的llvm目录中,如下所示: sudo ln -s / usr / bin / clang ++ /usr/lib/llvm-3.2/bin/clang ++