在this tutorial之后,我尝试使用以下命令将C程序编译为WebAssembly。
private void Storyboard_Completed(object sender, EventArgs e)
{
MainWindow parentWindow = Window.GetWindow(this) as MainWindow;
if (parentWindow != null)
{
parentWindow._loginModalControl.Visibility = Visibility.Visible;
this.Visibility = Visibility.Collapsed;
}
}
但我遇到了“emcc hello.c -s WASM=1 -o hello.html
”问题。
No available targets are compatible with this triple.
如何解决?
$ emcc hello.c -s WASM=1 -o hello.html
WARNING root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO root: (Emscripten: Running sanity checks)
WARNING root: Assigning a non-existent settings attribute "WASM"
WARNING root: - did you mean one of ASM_JS?
WARNING root: - perhaps a typo in emcc's -s X=Y notation?
WARNING root: - (see src/settings.js for valid values)
/home/casper/Desktop/test/emsdk/clang/fastcomp/build_incoming_64/bin/lli: error creating EE: No available targets are compatible with this triple.
FAIL: Running the generated program failed!
$ emcc --version
emcc (Emscripten GCC-like replacement) 1.22.1 ()
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
答案 0 :(得分:2)
在启动WebAssembly之前,您正在运行emcc
版本1.22.1 dates back from 8/7/2014。
emsdk
必须安装了最新的emscripten版本(这是sdk-incoming-64bit
来自这些说明的内容:incoming
是最新的分支),但是较旧的emscripten在你的系统中找到。
执行命令
which emcc
echo $PATH
他们说什么?我怀疑你有一个旧的emscripten躺在那里。您可能还想检查和/或删除可能还包含过时信息的~/.emscripten
file。
您可以使用其绝对路径更改路径,删除旧的emscripten或调用SDK的emscripten(尽管如果其他脚本沿路径选择旧版本,这可能会失败)。
请勿忘记(根据教程的说明)激活您已安装的SDK:
./emsdk activate --build=Release sdk-incoming-64bit binaryen-master-64bit
并运行:
source ./emsdk_env.sh
需要为每个shell会话运行最后一个命令。如果您打开一个新的shell,则需要重新{ - 1}}然后重新启动SDK。