Repository navigation
Description
It looks like the recent change in how Command executes batch files(see rust-lang/cc-rs#239 for details) has also caused the emscripten target to regress and fail to compile on win32.
I'm also seeing the libc::c_char type change from *const i8 to *const u8 which is causing problems with a bunch of C bindings I have.
Below example works fine when I switch back to 1.19.0.
I tried this code:
https://github.com/vvanders/rust_command_repro
I expected to see this happen: Successful compile
Instead, this happened:
C:\dev\command_repro>cargo build --release --target=asmjs-unknown-emscripten
Compiling command_repro v0.1.0 (file:///C:/dev/command_repro)
error: linking with `emcc.bat` failed: exit code: 2
|
= note: "emcc.bat" "-s" "DISABLE_EXCEPTION_CATCHING=0" "-L" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib" "C:\\dev\\command_repro\\target\\asmjs-unknown-emscripten\\release\\deps\\command_repro-0b0fbd0388217b85.0.o" "-o" "C:\\dev\\command_repro\\target\\asmjs-unknown-emscripten\\release\\deps\\command_repro-0b0fbd0388217b85.js" "-s" "EXPORTED_FUNCTIONS=[\"_main\",\"___rdl_shrink_in_place\",\"___rdl_alloc_excess\",\"___rdl_usable_size\",\"___rdl_alloc\",\"___rdl_realloc_excess\",\"___rdl_realloc\",\"___rdl_oom\",\"___rdl_grow_in_place\",\"___rdl_alloc_zeroed\",\"___rdl_dealloc\",\"_rust_eh_personality\"]" "C:\\dev\\command_repro\\target\\asmjs-unknown-emscripten\\release\\deps\\command_repro-0b0fbd0388217b85.crate.allocator.o" "-O3" "--memory-init-file" "0" "-g0" "-s" "DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]" "-L" "C:\\dev\\command_repro\\target\\asmjs-unknown-emscripten\\release\\deps" "-L" "C:\\dev\\command_repro\\target\\release\\deps" "-L" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libstd-881b9fdbdf1d515b.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\liballoc_system-3c10208cdd7e61cb.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\librand-32f648f7f7567c6c.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libpanic_unwind-9cbadc6554202be9.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\liballoc-bc70b4efeaeb398c.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libstd_unicode-a0ad42dc8f5856aa.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libunwind-618c266cf9124966.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\liblibc-16f3b02b9a976b94.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libcore-21491ce3d14f1ef2.rlib" "C:\\Users\\valer\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\asmjs-unknown-emscripten\\lib\\libcompiler_builtins-b9713bd7f605c0b2.rlib" "-l" "c" "-s" "ERROR_ON_UNDEFINED_SYMBOLS=1"
= note: python: can't open file 'C:\dev\command_repro\\emcc': [Errno 2] No such file or directory
Meta
rustc --version --verbose:
C:\dev\command_repro>rustc --version --verbose
rustc 1.20.0 (f3d6973 2017-08-27)
binary: rustc
commit-hash: f3d6973
commit-date: 2017-08-27
host: x86_64-pc-windows-msvc
release: 1.20.0
LLVM version: 4.0
Activity
krampenschiesser commentedon Sep 10, 2017
Got the same issue here :(
alexcrichton commentedon Sep 11, 2017
Thanks for opening this up @vvanders!
Could you test out a possible solution for this? If you use
-C linkerto override the linker used here, does this program work?My hope is that we just need to do
cmd /c emcc.batrather thanemcc.bat, but that'd help confirm the fix!vvanders commentedon Sep 13, 2017
Hey @alexcrichton, can you explain down to use -C linker flag in a bit more detail? I'm not totally following the steps you listed out above.
alexcrichton commentedon Sep 13, 2017
Oh sure yeah, so ideally you could do:
And see if that works?
vvanders commentedon Sep 13, 2017
Yup, that appears to work. I'll look into the libc changes on the other issue but this should address things on Win32.
alexcrichton commentedon Sep 13, 2017
Ok excellent! I'll prepare a PR for this
alexcrichton commentedon Sep 13, 2017
Ok I've opened a PR for this change at #44542
I've also nominated that for beta to make sure we fix this in 1.21
alexcrichton commentedon Sep 13, 2017
In the meantime I've also tagged this as a stable regression, but it should be fixed by the PR above
alexcrichton commentedon Sep 15, 2017
Beta backported in #44357