我在这里聚会迟到了,但对于其他有同样问题的人。
使用 VS2015 的 CMake 文件构建的 emscripten-fastcomp 在 Windows 10 上运行。 emscripten 和 emscripten-fastcomp 都是从他们的 Github 存储库中克隆出来的。
文档here 要么已过时,要么根本不正确。对于初学者,请尝试运行 emcc -v,即没有任何要编译的文件。
R:\src\tools\emscripten>emcc -v
这应该让你得到这个:
> 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:
> C:\Users\user/.emscripten
>
> It contains our best guesses for the important paths, which are:
>
> LLVM_ROOT = /usr/bin
> NODE_JS = R:\apps\nodejs\node.exe
> EMSCRIPTEN_ROOT = R:\src\tools\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.
>
现在在
中编辑 LLVM_ROOT 变量
C:\Users\user\.emscripten
这样默认的
LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or '/usr/bin') # directory
改成这样的
LLVM_ROOT = os.path.expanduser(os.getenv('LLVM') or 'R:\\src\\tools\\emscripten-fastcomp\\build\\Debug\\bin') # directory.
注意转义的反斜杠,标准的单反斜杠\ 不起作用。
现在您应该能够像在
中一样运行测试并获得合理的结果
emcc -v tests/hello_world.cpp
然后会喷出这样的东西:
> R:\src\tools\emscripten>emcc -v tests/hello_world.cpp
> INFO:root:generating system asset: is_vanilla.txt... (this will be
> cached in "C:\Users\user\.emscripten_cache\is_vanilla.txt" for
> subsequent builds) INFO:root: - ok INFO:root:(Emscripten: Running
> sanity checks) INFO:root:(Emscripten: Running sanity checks) clang
> version 3.9.0 (https://github.com/kripken/emscripten-fastcomp-clang
> 60a7e9a9c22b67309e5b1258d38fadfa481a25d3)
> (https://github.com/kripken/emscripten-fastcomp
> 881bd352731d21c7117ad7e2ece347aacae83965) (emscripten 1.37.0 : 1.37.0)
> Target: asmjs-unknown-emscripten Thread model: posix InstalledDir:
> R:\src\tools\emscripten-fastcomp\build\Debug\bin
> "R:\\src\\tools\\emscripten-fastcomp\\build\\Debug\\bin\\clang++.exe"
> -cc1 -triple asmjs-unknown-emscripten -emit-llvm-bc -emit-llvm-uselists -disable-free -main-file-name hello_world.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -no-integrated-as -mconstructor-aliases -v -dwarf-column-info -debugger-tuning=gdb -coverage-file "C:\\Users\\user\\AppData\\Local\\Temp\\tmpk4sar7\\hello_world_0.o"
> -nostdsysteminc -nobuiltininc -resource-dir "R:\\src\\tools\\emscripten-fastcomp\\build\\Debug\\bin\\..\\lib\\clang\\3.9.0"
> -D __EMSCRIPTEN_major__=1 -D __EMSCRIPTEN_minor__=37 -D __EMSCRIPTEN_tiny__=0 -D _LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -std=c++03 -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir "R:\\src\\tools\\emscripten" -ferror-limit 19 -fmessage-length 80
> -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -nobuiltininc -nostdsysteminc "-isystemR:\\src\\tools\\emscripten\\system\\include\\libcxx"
> "-isystemR:\\src\\tools\\emscripten\\system\\lib\\libcxxabi\\include"
> "-isystemR:\\src\\tools\\emscripten\\system\\include\\compat"
> "-isystemR:\\src\\tools\\emscripten\\system\\include"
> "-isystemR:\\src\\tools\\emscripten\\system\\include\\SSE"
> "-isystemR:\\src\\tools\\emscripten\\system\\include\\libc"
> "-isystemR:\\src\\tools\\emscripten\\system\\lib\\libc\\musl\\arch\\emscripten"
> "-isystemR:\\src\\tools\\emscripten\\system\\local\\include"
> "-isystemR:\\src\\tools\\emscripten\\system\\include\\SDL" -o
> "C:\\Users\\user\\AppData\\Local\\Temp\\tmpk4sar7\\hello_world_0.o" -x
> c++ tests/hello_world.cpp clang -cc1 version 3.9.0 based upon LLVM
> 3.9.0 default target i686-pc-windows-msvc
> #include "..." search starts here:
> #include <...> search starts here: R:\src\tools\emscripten\system\include\libcxx
> R:\src\tools\emscripten\system\lib\libcxxabi\include
> R:\src\tools\emscripten\system\include\compat
> R:\src\tools\emscripten\system\include
> R:\src\tools\emscripten\system\include\SSE
> R:\src\tools\emscripten\system\include\libc
> R:\src\tools\emscripten\system\lib\libc\musl\arch\emscripten
> R:\src\tools\emscripten\system\local\include
> R:\src\tools\emscripten\system\include\SDL End of search list.
希望这可以节省其他人的节礼日头发撕裂。祝你好运。