< 返回版块

abunchlotus 发表于 2021-02-04 11:01

Tags:编译环境

ide是clion,配置了mingw,也安装了rust环境

结果每次编译都会报这个错误

error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
  |
  = note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-m64" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\49062\\.
rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.1gs6ofqzdwp2w441.rcgu.o" "D
:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.36fv0c8c564nbo2r.rcgu.o" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-
41ed472fd7c1db18.36icbqu4968ymdxo.rcgu.o" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.38or7v6dpp12j193.rcgu.o" "D:\\code\\client-c-release-4.0\\untitled\\target\\x
86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.4wg6tnrlcoq0zt4x.rcgu.o" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.57e88y41dr9k4uwy.rcgu.o" "D:\\cod
e\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.5c2bm2x3sgeorega.rcgu.o" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed47
2fd7c1db18.5cqto7yucjq4sgwa.rcgu.o" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.wq16jypbpxnyard.rcgu.o" "-o" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86
_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.exe" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps\\untitled-41ed472fd7c1db18.4h929bo1b83szf3h.rcgu.o" "-Wl,--gc-sections" "-nodefaul
tlibs" "-L" "D:\\code\\client-c-release-4.0\\untitled\\target\\x86_64-pc-windows-gnu\\debug\\deps" "-L" "D:\\code\\client-c-release-4.0\\untitled\\target\\debug\\deps" "-L" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-wi
ndows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,--start-group" "-Wl,-Bstatic" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-8394c9398cbadee5.rlib" "C
:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-886e4f572a6d227c.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\
\x86_64-pc-windows-gnu\\lib\\libobject-17cf826d0f7d2ed3.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libaddr2line-0dad5a98c26b9739.rlib" "C:\\Users\\49062\\.ru
stup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgimli-dfab679e0565d217.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib
\\librustc_demangle-9f6866b4336a1d1c.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-81ade66b9e4c9cd5.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\s
table-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-4149a301273ebf0c.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\li
b\\libunwind-738a3de7ad0cd3a3.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-06d418ce9254f841.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_
64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-7c3291a8d67347b3.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-9f2b7229edc9025e.rl
ib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-4ae0cac901a4e3c1.rlib" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-
gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-9e39cfd0b85a4b6e.rlib" "-Wl,--end-group" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-de7
0f57e5c136950.rlib" "-Wl,-Bdynamic" "-ladvapi32" "-lws2_32" "-luserenv" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\49062\\.rustup\\toolchains\\stable-x86_64
-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: D:\code\client-c-release-4.0\untitled\target\x86_64-pc-windows-gnu\debug\deps\untitled-41ed472fd7c1db18.4wg6tnrlcoq0zt4x.rcgu.o: In function `std::sys_common::backtrace::__rust_begin_short_backtrace':
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib/rustlib/src/rust\library\std\src\sys_common/backtrace.rs:121: undefined reference to `_Unwind_Resume'
          D:\code\client-c-release-4.0\untitled\target\x86_64-pc-windows-gnu\debug\deps\untitled-41ed472fd7c1db18.5cqto7yucjq4sgwa.rcgu.o: In function `core::ops::function::FnOnce::call_once':
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib/rustlib/src/rust\library\core\src\ops/function.rs:227: undefined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-8394c9398cbadee5.rlib(std-8394c9398cbadee5.std.2t929vrk-cgu.0.rcgu.o): In function `<std::backtrace::BytesOrWide a
s core::fmt::Debug>::fmt':
          /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src/backtrace.rs:231: undefined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-8394c9398cbadee5.rlib(std-8394c9398cbadee5.std.2t929vrk-cgu.0.rcgu.o): In function `core::ops::function::FnOnce::c
all_once':
          /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\library\core\src\ops/function.rs:227: undefined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-8394c9398cbadee5.rlib(std-8394c9398cbadee5.std.2t929vrk-cgu.0.rcgu.o): In function `std::io::stdio::stdout::cleanu
p':
          /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\std\src\io/stdio.rs:563: undefined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libstd-8394c9398cbadee5.rlib(std-8394c9398cbadee5.std.2t929vrk-cgu.0.rcgu.o):/rustc/e1884a8e3c3e813aada8254edfa120e85bf5f
fca\library\core\src\ops/function.rs:227: more undefined references to `_Unwind_Resume' follow
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-886e4f572a6d227c.rlib(panic_unwind-886e4f572a6d227c.panic_unwind.aglxyyzs-cgu.0.rcgu.o): In function `pan
ic_unwind::real_imp::panic':
          /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\panic_unwind\src/gcc.rs:62: undefined reference to `_Unwind_RaiseException'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-886e4f572a6d227c.rlib(panic_unwind-886e4f572a6d227c.panic_unwind.aglxyyzs-cgu.0.rcgu.o): In function `rus
t_eh_personality':
          /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca\/library\panic_unwind\src/gcc.rs:273: undefined reference to `_GCC_specific_handler'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libobject-17cf826d0f7d2ed3.rlib(object-17cf826d0f7d2ed3.object.x0imtck8-cgu.0.rcgu.o):object.x0imtck8-cg:(.text+0xc313):
undefined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libobject-17cf826d0f7d2ed3.rlib(object-17cf826d0f7d2ed3.object.x0imtck8-cgu.0.rcgu.o):object.x0imtck8-cg:(.text+0x13197):
 undefined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libobject-17cf826d0f7d2ed3.rlib(object-17cf826d0f7d2ed3.object.x0imtck8-cgu.0.rcgu.o):object.x0imtck8-cg:(.text+0x1912a):
 undefined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-dfab679e0565d217.rlib(gimli-dfab679e0565d217.gimli.3bpkbg3z-cgu.0.rcgu.o):gimli.3bpkbg3z-cgu:(.text+0x2c59): und
efined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-dfab679e0565d217.rlib(gimli-dfab679e0565d217.gimli.3bpkbg3z-cgu.0.rcgu.o):gimli.3bpkbg3z-cgu:(.text+0x2d54): und
efined reference to `_Unwind_Resume'
          C:\Users\49062\.rustup\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\libgimli-dfab679e0565d217.rlib(gimli-dfab679e0565d217.gimli.3bpkbg3z-cgu.0.rcgu.o):gimli.3bpkbg3z-cgu:(.text+0x2f7e): mor
e undefined references to `_Unwind_Resume' follow
          collect2.exe: error: ld returned 1 exit status


error: aborting due to previous error; 1 warning emitted

error: could not compile `untitled`

To learn more, run the command again with --verbose.

现在已经被环境搞崩溃了

评论区

写评论
作者 abunchlotus 2021-02-04 11:49

手动cargo也是这个编译信息,环境变量为

lib:D:\mingw64\lib include:D:\mingw64\include Path:D:\mingw64\bin RUSTUP_DIST_SERVER:http://mirrors.ustc.edu.cn/rust-static RUSTUP_UPDATE_ROOT: http://mirrors.ustc.edu.cn/rust-static/rustup

--
👇
Mike Tang: 你手动cargo试试打印信息呢?

我这边配置没问题。环境变量这些你怎么配置的。

我用 win-builds-1.5.0 安装的 mingw.

Mike Tang 2021-02-04 11:07

你手动cargo试试打印信息呢?

我这边配置没问题。环境变量这些你怎么配置的。

我用 win-builds-1.5.0 安装的 mingw.

1 共 2 条评论, 1 页