我遲到了這裏的黨,但對於其他人同樣的問題(一個或多個)。
在Windows 10上使用emscripten-fastcomp在VS2015中使用CMake文件構建。 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.
希望這樣可以節省別人的節禮日頭髮撕裂。祝你好運。