rust-lang-deprecated / error-chain

Error boilerplate for Rust
Apache License 2.0
728 stars 111 forks source link

gcc error while testing #290

Closed ywxt closed 3 years ago

ywxt commented 4 years ago
use error_chain::error_chain;
fn main() {
    println!("Hello, world!");
    let _path = dirs::home_dir();
}

When the crate is used with dirs and I try to run cargo test, a gcc error occurs. I don't know what went wrong.

error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "D:\\Rust\\Rustup\\toolchains\\stable-x86_
64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-wi
ndows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-wi
ndows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e6
0f402c1.13lk4fuu55w47lwe.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.169j9c5ha6hr
6uyk.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.1brvr1sfvhor1mkh.rcgu.o" "E:\\Pr
oject\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.1cjjq73kguapbvjt.rcgu.o" "E:\\Project\\ssr-sub-rust\
\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.1eg4wfyckd9gffe3.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps
\\ssr_sub-a3844f7e60f402c1.1m572kadb7reutzb.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60
f402c1.1o3pkbij4voga1lp.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.1s2q1p4cn25aw
jtg.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.1w3aq7wnwhics2wv.rcgu.o" "E:\\Pro
ject\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.1xs29hx1mwagbm3o.rcgu.o" "E:\\Project\\ssr-sub-rust\\
target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.20f28jgj01t7rt7f.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\
\ssr_sub-a3844f7e60f402c1.20iym3seff83np6p.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f
402c1.22n0dvwdidmgx15l.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.247ysbwj2ha8ed
fn.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.292imitdj7u5ai0t.rcgu.o" "E:\\Proj
ect\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.29oqjpaoyud5wc2i.rcgu.o" "E:\\Project\\ssr-sub-rust\\t
arget\\debug\\deps\\ssr_sub-a3844f7e60f402c1.29rvp9hfkc3ljayh.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\
ssr_sub-a3844f7e60f402c1.2cfrk3dk11y4awmi.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f4
02c1.2fiwa1rzrnnz0he8.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.2id7crdnkf11eyh
o.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.2ieffgwanzamn4qq.rcgu.o" "E:\\Proje
ct\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.2oi57d4zas4oru5k.rcgu.o" "E:\\Project\\ssr-sub-rust\\ta
rget\\debug\\deps\\ssr_sub-a3844f7e60f402c1.2ppfbxobksus9gcr.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\s
sr_sub-a3844f7e60f402c1.2pwu2s179wb8x41c.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f40
2c1.2uef3atwlail831k.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.2wmikwuqzd1fctum
.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.2zvf82f2wj2dtlsk.rcgu.o" "E:\\Projec
t\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.342qi39cohiq9869.rcgu.o" "E:\\Project\\ssr-sub-rust\\tar
get\\debug\\deps\\ssr_sub-a3844f7e60f402c1.34wqfhkolzk8keem.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ss
r_sub-a3844f7e60f402c1.37rld56d7minhgpo.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402
c1.3ah8p37w3tnugvky.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.3buovvj6idsv164y.
rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.45r36nbqgo0o1581.rcgu.o" "E:\\Project
\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.46px19d8i11g9dpu.rcgu.o" "E:\\Project\\ssr-sub-rust\\targ
et\\debug\\deps\\ssr_sub-a3844f7e60f402c1.4ei9le4kaqq27c72.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr
_sub-a3844f7e60f402c1.4mn6k4lch65azhgz.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c
1.52ttuv49s0wm1eti.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.541t6qe55h1xqlmg.r
cgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.56hfhs7qpqkzr3hj.rcgu.o" "E:\\Project\
\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.57dbxt7sknd8vrg4.rcgu.o" "E:\\Project\\ssr-sub-rust\\targe
t\\debug\\deps\\ssr_sub-a3844f7e60f402c1.59pijwsp4egpg02w.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_
sub-a3844f7e60f402c1.5b3vifhq4f7l3zqc.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1
.8zv0timj0896dqi.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.9ole251ikol968n.rcgu
.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.bw46j6v7l0254o2.rcgu.o" "E:\\Project\\ssr
-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.krbt87ev37rpsmo.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\de
bug\\deps\\ssr_sub-a3844f7e60f402c1.n9tsv2iyvxql737.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3
844f7e60f402c1.slafqiivo4636dm.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.vmh1jh
gzn2cq2ya.rcgu.o" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.z750xyh9hly7j9v.rcgu.o" "-o
" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\ssr_sub-a3844f7e60f402c1.exe" "E:\\Project\\ssr-sub-rust\\target\\de
bug\\deps\\ssr_sub-a3844f7e60f402c1.2v3f77qnh0f6kj88.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "E:\\Project\\ss
r-sub-rust\\target\\debug\\deps" "-L" "D:\\Rust\\Cargo\\registry\\src\\mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd\\w
inapi-x86_64-pc-windows-gnu-0.4.0\\lib" "-L" "E:\\Project\\ssr-sub-rust\\target\\debug\\build\\backtrace-sys-a431b4f647
edf62f\\out" "-L" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib
" "-Wl,-Bstatic" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\libdirs-5823bc7f09291622.rlib" "E:\\Project\\ssr-sub-
rust\\target\\debug\\deps\\libdirs_sys-077ab72f8f57bcd0.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\libwinap
i-cfdef71de770c40b.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\libserde_json-aad127ddbde58f2e.rlib" "E:\\Pro
ject\\ssr-sub-rust\\target\\debug\\deps\\libryu-02e2226c4bace50c.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\
\libitoa-c2184fc85e8d4f08.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\libbase64-e2471ed4aaa89351.rlib" "E:\\
Project\\ssr-sub-rust\\target\\debug\\deps\\libserde-13d17b410ea88c90.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\
deps\\liberror_chain-31b6b1e011a65ccc.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\libbacktrace-d91a6473b7cc9
e1d.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\libbacktrace_sys-df64e9b190b4c447.rlib" "E:\\Project\\ssr-su
b-rust\\target\\debug\\deps\\liblibc-89997634662d0c87.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\libcfg_if-
9aad1db24ad50a6d.rlib" "E:\\Project\\ssr-sub-rust\\target\\debug\\deps\\librustc_demangle-3f546688e87a2916.rlib" "-Wl,-
-start-group" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\li
bstd-2709d4b440f1e31a.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-window
s-gnu\\lib\\libpanic_unwind-a9004ff0947ef669.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\ru
stlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-51ba26adca1c882c.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-
windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-845f51604911fcc4.rlib" "D:\\Rust\\R
ustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libbacktrace-de041ab5ae3894b
3.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libbackt
race_sys-583b927240902ae3.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-wi
ndows-gnu\\lib\\librustc_demangle-dc3974e5e5ee3f1e.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\l
ib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-93e1dea24f969698.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-
pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-59c69470ac86444e.rlib" "D:\\Rust\\Rustup\\toolchain
s\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-5fe3f715aad021c1.rlib" "D:\\Rust\\Ru
stup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-289552190fa6ddd0.rli
b" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_
workspace_core-663fc4811d41d373.rlib" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64
-pc-windows-gnu\\lib\\libcore-985f2d98a138c88e.rlib" "-Wl,--end-group" "D:\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-
windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-8d584b80572e52da.rlib" "-Wl,-Bdynamic" "-lw
inapi_advapi32" "-lwinapi_cfgmgr32" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_ole32" "-lwinapi_
opengl32" "-lwinapi_shell32" "-lwinapi_user32" "-lwinapi_winspool" "-ladvapi32" "-lws2_32" "-luserenv" "-Wl,-Bstatic" "
-lgcc_eh" "-lpthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "D:
\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: E:\Project\ssr-sub-rust\target\debug\deps\libbacktrace_sys-df64e9b190b4c447.rlib(alloc.o):alloc.c:(.text$__rb
t_backtrace_alloc+0x37): undefined reference to `__errno'
          E:\Project\ssr-sub-rust\target\debug\deps\libbacktrace_sys-df64e9b190b4c447.rlib(alloc.o):alloc.c:(.text$__rb
t_backtrace_vector_grow+0xbf): undefined reference to `__errno'
          E:\Project\ssr-sub-rust\target\debug\deps\libbacktrace_sys-df64e9b190b4c447.rlib(alloc.o):alloc.c:(.text$__rb
t_backtrace_vector_release+0x43): undefined reference to `__errno'
          E:\Project\ssr-sub-rust\target\debug\deps\libbacktrace_sys-df64e9b190b4c447.rlib(posix.o):posix.c:(.text$__rb
t_backtrace_open+0x48): undefined reference to `__errno'
          E:\Project\ssr-sub-rust\target\debug\deps\libbacktrace_sys-df64e9b190b4c447.rlib(posix.o):posix.c:(.text$__rb
t_backtrace_open+0x60): undefined reference to `__errno'
          E:\Project\ssr-sub-rust\target\debug\deps\libbacktrace_sys-df64e9b190b4c447.rlib(posix.o):posix.c:(.text$__rb
t_backtrace_close+0x20): more undefined references to `__errno' follow
AndyGauge commented 4 years ago

I'm not certain either, but I think I'd hit up discord with this question. https://discordapp.com/invite/rust

ywxt commented 4 years ago

I'm not certain either, but I think I'd hit up discord with this question. https://discordapp.com/invite/rust

Thank you for your reply. I will continue to follow this question.

ywxt commented 4 years ago

I have solved this problem by switching the toolchain to msvc. Thanks.