首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >EMScripten构建示例项目失败

EMScripten构建示例项目失败
EN

Stack Overflow用户
提问于 2012-04-28 09:17:58
回答 3查看 1.3K关注 0票数 0

我在试着让EMScripten正常工作。我确信我已经遵循了本教程,并确保安装了上面提到的依赖项。

当尝试构建一个示例项目时,它失败了,如下所示;

代码语言:javascript
复制
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的内容

代码语言:javascript
复制
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]

我不知道问题是什么-需要帮助进行故障排除。这里有没有人知道哪里会错呢?我错过了什么?

EN

回答 3

Stack Overflow用户

发布于 2012-06-18 07:37:38

你试过最新的Emscripten了吗?

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

代码语言:javascript
复制
print 'LLVM_OPT IS: <' + LLVM_OPT + '>'

在下一次编译时,这应该会将LLVM_OPT的路径打印到您的标准输出。这个路径可能不存在,所以您可能只需要一个符号链接,因为opt二进制文件有一个版本附录或类似的东西。

票数 0
EN

Stack Overflow用户

发布于 2013-06-04 04:33:07

看看你的路径。我正在使用Emscripten,在经历了一系列令人困惑的失败之后,我发现我的路径信息是错误的。特别是我的LLVM_ROOT。这对我来说是正确的:

代码语言:javascript
复制
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)。

票数 0
EN

Stack Overflow用户

发布于 2013-07-25 05:18:55

确保clang位于您的llvm目录中,并使用如下命令进行符号链接: sudo ln -s /usr/bin/clang++ /usr/lib/llvm-3.2/bin/clang++

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10359735

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档