Closed akatechis closed 4 years ago
A symlink is one option, another is to set python2
in the settings file where it has PYTHON=
there.
Generally Git Bash and Cygwin are untested configurations, so rough edges are expected there.
You could try explicitly running emcc.bat
instead of emcc
, because that batch file is what gets invoked when running on a native Windows command prompt. Although I'm scratching my head a bit to try to understand why it is accessing python2
here even, since the shebang at https://github.com/kripken/emscripten/blob/incoming/emcc#L1 doesn't have python2
and I think this line shouldn't be hit either, because the earlier if sys.version_info.major == 2:
should be true since you've got Python 2.7.
I'm hitting the same issue, but mine seems unrelated to python:
λ rustc --target=asmjs-unknown-emscripten hello.rs | clip
error: could not exec the linker `emcc`: The system cannot find the file specified. (os error 2)
|
= note: "emcc" "-L" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib" "hello.0.o" "-o" "hello.js" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libstd-17342542cc541012.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\librand-46ed9b788a6928f6.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libpanic_unwind-f78756b576499725.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libcollections-e32369d7fef31fbf.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\liballoc-24699c1ddb055eb0.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\liballoc_system-3e467e865c8fa572.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libunwind-11f7709e0c71505b.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\liblibc-60365c932e50e382.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\librustc_unicode-844a33a197b559a5.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libcore-d9873b515905cac5.rlib" "C:\\Users\\crame\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libcompiler_builtins-e428224f6caf212a.rlib" "-l" "c" "-s" "ERROR_ON_UNDEFINED_SYMBOLS=1"
error: aborting due to previous error
Running emcc
directly on the resulting .o
files gives an error like the following:
C:/Program Files/Emscripten/clang/fastcomp/build_incoming_vs2015_64/RelWithDebInfo/bin\llvm-link: c:userscrameappdatalocaltemptmpprnv9pstrlwr.c.o: error: Could not open input file: no such file or directory
C:/Program Files/Emscripten/clang/fastcomp/build_incoming_vs2015_64/RelWithDebInfo/bin\llvm-link: error loading file 'c:userscrameappdatalocaltemptmpprnv9pstrlwr.c.o'
Traceback (most recent call last):
File "C:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line 1222, in <module>
extra_files_to_link += system_libs.calculate([f for _, f in sorted(temp_files)] + extra_files_to_link, in_temp, stdout, stderr, forced=forced_stdlibs)
File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\system_libs.py", line 339, in calculate
libfile = shared.Cache.get(name, do_create, extension=suffix)
File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\cache.py", line 41, in get
temp = creator()
File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\system_libs.py", line 337, in do_create
ret = create(name)
File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\system_libs.py", line 119, in create_libc
return build_libc(libname, libc_files, args)
File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\system_libs.py", line 66, in build_libc
shared.Building.link(o_s, in_temp(lib_filename))
File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\shared.py", line 1432, in link
assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
AssertionError: Linking error:
And no, there's nothing after "Linking error:" 😄
I believe the issue is inside rustc
, and it is attempting to invoke the executable emcc
without enabling shell expansion. In that case, the compiler name should be specified as emcc.bat
or ['python', 'emcc']
(The file emcc
in the repository is a python file and not an executable file), or rustc
be fixed to enable shell expansion on the subprocess it is spawning so that Windows properly expands it to rustc.bat
.
Perhaps report this to Rust bug tracker?
Has anyone found the solution to this problem?
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.
Full error message:
I'm currently following the instructions at https://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627 to compile some rust code into wasm32.
I followed the instructions to install emscriptensdk from the website, and ran the following:
I suspect that the issue is python, because when I just run
emcc
command, I get/usr/bin/env: ‘python2’: No such file or directory
, but if I runwhich python
I get/c/Python27/python
. I'm using Git Bash rather than CMD. Should I create a symlink to point python2 to python?