Windows 10 error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
Windows 10 error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
我正在努力修复 error: linking with 'x86_64-w64-mingw32-gcc; failed: exit code: 1
,我已经安装了 TDM-GCC-64 和 Cygwin 并将它们添加到 PATH 以及更新了 c++ 2019 可再发行组件。我正在尝试使用 GLFW 或替代品,但每当我尝试 运行 使用 GLFW 或其替代品的 Rust 项目时,我都会收到此错误 note: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_eh
是不是我还缺少其他东西。谢谢
下面是完整的错误
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsbegin.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.0.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.1.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.10.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.11.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.12.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.13.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.14.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.15.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.2.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.3.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.4.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.5.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.6.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.7.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.8.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.9.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.3xe3r320o5t2g1tt.rcgu.o" "-L" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\deps" "-L" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "-Wl,--start-group" "-Wl,-Bstatic" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-9075868f02c39105.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-9428c324e8b3666b.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libobject-4a98078f239020c3.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libmemchr-6757767b31fe77e1.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libaddr2line-c0d2da11c6d2d6c0.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-9e7d4e8bc407ad15.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librustc_demangle-da42fc4024365a2c.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd_detect-89ac367f33223d21.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libhashbrown-d506a327105b7f9b.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librustc_std_workspace_alloc-59684a51af165391.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libunwind-76b6cbab8df641fe.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcfg_if-1f71fd1e2c1fff1d.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liblibc-941c197b7acaf3f9.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liballoc-ed65eeea771bb49a.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librustc_std_workspace_core-206ecc270c58e4f3.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcore-1063c1f162c501e3.rlib" "-Wl,--end-group" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-3f91c8bbaf203c3c.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lws2_32" "-lbcrypt" "-ladvapi32" "-luserenv" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "-o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsend.o"
= note: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_eh
collect2.exe: error: ld returned 1 exit status
首先:TDM、Cygwin 和 2019-redestributable 是三个不同的tool-chains。相似但不同,你不应该把它们混在一起。您需要选择一种环境,即 TDM 风格的 MinGW、Cygwin 或 Visual Studio。并坚持下去。有时可以重用一些工具链,但这并不容易,需要对两者都有很好的理解 tool-chains.
其次:阅读错误消息“ld.exe:无法找到 -lgcc_eh” - 这意味着您的链接器无法找到库 gcc_eh。那个图书馆是什么?您要编译哪个项目?
转到项目文档,找到安装说明并按照书面说明进行操作。此说明(很可能)会建议 tool-chain 也使用哪个。
我正在努力修复 error: linking with 'x86_64-w64-mingw32-gcc; failed: exit code: 1
,我已经安装了 TDM-GCC-64 和 Cygwin 并将它们添加到 PATH 以及更新了 c++ 2019 可再发行组件。我正在尝试使用 GLFW 或替代品,但每当我尝试 运行 使用 GLFW 或其替代品的 Rust 项目时,我都会收到此错误 note: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_eh
是不是我还缺少其他东西。谢谢
下面是完整的错误
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsbegin.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.0.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.1.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.10.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.11.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.12.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.13.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.14.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.15.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.2.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.3.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.4.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.5.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.6.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.7.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.8.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.build_script_build.253ad390-cgu.9.rcgu.o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.3xe3r320o5t2g1tt.rcgu.o" "-L" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\deps" "-L" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "-Wl,--start-group" "-Wl,-Bstatic" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-9075868f02c39105.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-9428c324e8b3666b.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libobject-4a98078f239020c3.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libmemchr-6757767b31fe77e1.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libaddr2line-c0d2da11c6d2d6c0.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-9e7d4e8bc407ad15.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librustc_demangle-da42fc4024365a2c.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd_detect-89ac367f33223d21.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libhashbrown-d506a327105b7f9b.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librustc_std_workspace_alloc-59684a51af165391.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libunwind-76b6cbab8df641fe.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcfg_if-1f71fd1e2c1fff1d.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liblibc-941c197b7acaf3f9.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\liballoc-ed65eeea771bb49a.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\librustc_std_workspace_core-206ecc270c58e4f3.rlib" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcore-1063c1f162c501e3.rlib" "-Wl,--end-group" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libcompiler_builtins-3f91c8bbaf203c3c.rlib" "-Wl,-Bdynamic" "-lkernel32" "-lws2_32" "-lbcrypt" "-ladvapi32" "-luserenv" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib" "-o" "C:\Users\peter\Desktop\Rust_Programming\Code\Opengl_Lessons\learn-opengl-rs\target\debug\build\num-complex-1d9dcc0a2e0581fe\build_script_build-1d9dcc0a2e0581fe.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "C:\Users\peter\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\rsend.o"
= note: C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_eh
collect2.exe: error: ld returned 1 exit status
首先:TDM、Cygwin 和 2019-redestributable 是三个不同的tool-chains。相似但不同,你不应该把它们混在一起。您需要选择一种环境,即 TDM 风格的 MinGW、Cygwin 或 Visual Studio。并坚持下去。有时可以重用一些工具链,但这并不容易,需要对两者都有很好的理解 tool-chains.
其次:阅读错误消息“ld.exe:无法找到 -lgcc_eh” - 这意味着您的链接器无法找到库 gcc_eh。那个图书馆是什么?您要编译哪个项目?
转到项目文档,找到安装说明并按照书面说明进行操作。此说明(很可能)会建议 tool-chain 也使用哪个。