cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.71k stars 375 forks source link

install cross error #332

Closed reison1218 closed 2 years ago

reison1218 commented 5 years ago

when i install cross on my windows10 System has error like this: error: linking with gcc failed: exit code: 1 |= note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\Users\Administrator\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o" "C:\Users\Administrator\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsbegin.o" "-L" "C:\Users\Administrator\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "C:\Users\ADMINI~1\AppData\Local\Temp\cargo-installu8IM0C\release\deps\cross-81b615ccfb4b8a3e.cross.296spa13-cgu.1.rcgu.o" "-o" "C:\Users\ADMINI~1\AppData\Local\Temp\cargo-installu8IM0C\release\deps\cross-81b615ccfb4b8a3e.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\Users\ADMINI~1\AppData\Local\Temp\cargo-installu8IM0C\release\deps" "-L" "C:\Users\Administrator\.cargo\registry\src\mirrors.ustc.edu.cn-b63e9dae659fc205\winapi-x86_64-pc-windows-gnu-0.4.0\lib" "-L" "C:\Users\ADMINI~1\AppData\Local\Temp\cargo-installu8IM0C\release\build\backtrace-sys-eaecc79c72a69fc9\out" "-L" "C:\Users\Administrator\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "-Wl,-Bstatic" "C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-c566b1b3cd0457c0.rlib" "-Wl,--start-group" "C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-7b39346dbdaf0ea0.rlib" "-Wl,--end-group" "C:\Users\Administrator\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-b543334d3afc103d.rlib" "-Wl,-Bdynamic" "-lwinapi_advapi32" "-lwinapi_cfgmgr32" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_opengl32" "-lwinapi_user32" "-lwinapi_winspool" "-ladvapi32" "-lws2_32" "-luserenv" "-Wl,-Bstatic" "-lgcc_eh" "-lpthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "C:\Users\Administrator\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsend.o" = note: C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-c566b1b3cd0457c0.rlib(alloc.o):alloc.c:(.text$rbt_backtrace_alloc+0x31): undefined reference to `errno' C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-c566b1b3cd0457c0.rlib(alloc.o):alloc.c:(.text$rbt_backtrace_vector_grow+0xb1): undefined reference to `__errno' C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-c566b1b3cd0457c0.rlib(alloc.o):alloc.c:(.text$rbt_backtrace_vector_finish+0x51): undefined reference to __errno' C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-c566b1b3cd0457c0.rlib(alloc.o):alloc.c:(.text$__rbt_backtrace_vector_release+0x41): undefined reference toerrno' C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-c566b1b3cd0457c0.rlib(posix.o):posix.c:(.text$rbt_backtrace_open+0x2f): undefined reference to `errno' C:\Users\ADMINI~1\AppData\Local\Temp\rustcMIQif5\libbacktrace_sys-c566b1b3cd0457c0.rlib(posix.o):posix.c:(.text$rbt_backtrace_open+0x39): more undefined references to `__errno' follow error: aborting due to previous error

error: failed to compile cross v0.1.16 (registryhttps://mirrors.ustc.edu.cn/crates.io-index/), intermediate artifacts can be found at C:\Users\ADMINI~1\AppData\Local\Temp\cargo-installu8IM0C

Caused by: Could not compile cross.

rust:1.38 toolchain:stable-x86_64-pc-windows-gnu PC OS:windows10

Alexhuszagh commented 2 years ago

I'm unable to reproduce this where my GCC compiler is a prebuilt GNU toolchain from the VisualGDB Visual Studio code extension (provided here). I'd need further information to reproduce this.

> rustup toolchain add stable-x86_64-pc-windows-gnu
> rustup run stable-x86_64-pc-windows-gnu rustc --version
rustc 1.61.0 (fe5b13d68 2022-05-18)
> rustup run stable-x86_64-pc-windows-gnu cargo install cross
> which gcc  # Note: using CMDer so this works
/c/SysGCC/mingw64/bin/gcc

And everything installs properly on my end. Current OS is Windows 10 Home, Version 21H2, for an OS build of 19044.1706.