rustrust-cargorust-tokio

Rust cannot link with `x86_64-w64-mingw32-gcc`


I am trying to make a get request to a url with rust and everytime I run this project I get this error, my other rust project work fine. here's my cargo.toml file.

[package]
name = "api_req"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1.0", features = ["derive"] }
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", features = ["full"]}

this is the output I get when I try to build/run the code.

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\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\self-contained\\crt2.o" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1ax3t6bk8kjti15h.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1c3atn0g0p3yramu.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1eyopyznq7w9pv6w.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1fh5351sg6p2mgxa.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1fq8n5qa6sftc8f2.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1h7rs4y9okqh73ko.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1hixbhmcdx93ieog.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1pusjb2s5mbmv52.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1r1syzr5iyppur6d.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1xwze9zzctkvw9zb.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.1yo20a6n3puo41ow.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.2255vjpd8xu3a9fy.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.2edfs4qapam51lge.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.2golmsqmo7tnqmzs.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.2xmnjdctq8pjocz5.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.31yrs14s300f4h03.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.33t6gyz621qwigyb.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.3832xteup6xjvzhl.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.3ei96tkdhrg5j4cc.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.3kv9qzjbq6hyvxta.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.3voeuxa39e6i45ek.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.3xczvelu7g3dfuy.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.3xiefxn2bjk8p9wl.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.3zk8kwi563txarv.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.42fx8502ycrtb947.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.42zj1hqr5806tbqq.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.4n2j2pvi987bzjpx.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.4swl56hmxo29rz14.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.4uil31v1upy7ekhm.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.4ux7vz70q14tv1sd.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.5bfbrmu7jie92ld4.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.5c9yop588litxlcp.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.5f5utchxm690fhml.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.8e1pp3wjkpz0u44.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.a6wm8bvo6xgk6kb.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.kov6im1dt7n1158.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.qc6r0urfqm5iwfk.rcgu.o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.xbwmoxc4z4laoj.rcgu.o" "-L" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps" "-L" "C:\\Users\\sahil\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\windows_x86_64_gnu-0.36.1\\lib" "-L" "C:\\Users\\sahil\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\winapi-x86_64-pc-windows-gnu-0.4.0\\lib" "-L" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libreqwest-4c368552b14f2556.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libhyper_tls-232c1bed3548a04d.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libserde_urlencoded-7fbc481ab99fd7fa.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libwinreg-7295b139d2c97e9c.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libipnet-13ad1b1c2a806ac2.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtokio_native_tls-de7295e0ba3eee80.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libmime-70beac1aae20854a.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libencoding_rs-424738c02de2a1cb.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libserde_json-6dd5b460183685b0.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libryu-5dbe4d0271ae441b.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libserde-6cae6f9f61ff4ba4.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libbase64-c8247454f82b9007.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libnative_tls-6c7c022aaeb526d4.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libschannel-063e1b413f5599f2.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libhyper-fb95c482b8443496.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libwant-1b592153b3050a9c.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtry_lock-d260f441477de4db.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libhttparse-6fcd91990256da53.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libh2-5a39fe982856f022.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libindexmap-4a28fef51076f054.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libhashbrown-d5a9f68bf8fda90f.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libslab-9fe051d950420d38.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtokio_util-1579a0114f5cbde1.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libfutures_sink-c7192b01df39fa48.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtower_service-765eb6356a8cfb2d.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtracing-66051f4777353503.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtracing_core-f4bfb6d49a965157.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libfutures_channel-555bafa627f1f911.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libfutures_util-64a02818b3317840.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libfutures_task-a4aaaaf936eb564c.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libpin_utils-5d8a7e5aa44622ca.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtokio-624e271f708ed1b7.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libnum_cpus-e6114d81f932153f.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libsocket2-f5d2e21f1a9eced5.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libmemchr-159ce0a562c7c90d.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libonce_cell-d421f50ef94c81e2.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libmio-5b2251bc0fa70cc1.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libwinapi-ea296c23c7d12570.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libparking_lot-5543975f87a49a76.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libparking_lot_core-1f22f50f85af7c5b.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libwindows_sys-b637485aaa7aff92.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libsmallvec-2f06c5bbc2f28d1d.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\liblock_api-cf5b6e95d6264008.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libscopeguard-2307887b33c22022.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libhttp_body-b0dac3684cf21643.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libpin_project_lite-7f5a255ae99cc584.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\liblog-4a472ba51f3a8c65.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libcfg_if-582d68df1dda34ce.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libfutures_core-d4fb194ef52b209e.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\liblazy_static-3560e2a9d79ed69d.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\liburl-0607b9926a2db71d.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libidna-b2a78f283642d804.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libunicode_normalization-35bc20584746fa68.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtinyvec-142577d0da361009.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libtinyvec_macros-4336a28f2bcab56f.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libunicode_bidi-5f2fd3eb1aae333c.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libform_urlencoded-53698e084bc4bbdc.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libpercent_encoding-667b3b2a6857c78b.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libmatches-20581ad2b0980e8c.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libhttp-4a12e877f9b0b8fa.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libitoa-3604916ff8b9be67.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libbytes-4258675eb663602c.rlib" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\libfnv-45e655d72242f0ae.rlib" "-Wl,--start-group" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-9075868f02c39105.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-9428c324e8b3666b.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libobject-4a98078f239020c3.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libmemchr-6757767b31fe77e1.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libaddr2line-c0d2da11c6d2d6c0.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgimli-9e7d4e8bc407ad15.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-da42fc4024365a2c.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_detect-89ac367f33223d21.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-d506a327105b7f9b.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-59684a51af165391.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-76b6cbab8df641fe.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-1f71fd1e2c1fff1d.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-941c197b7acaf3f9.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-ed65eeea771bb49a.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-206ecc270c58e4f3.rlib" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-1063c1f162c501e3.rlib" "-Wl,--end-group" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-3f91c8bbaf203c3c.rlib" "-Wl,-Bdynamic" "-lntdll" "-lwinapi_advapi32" "-lwinapi_cfgmgr32" "-lwinapi_fwpuclnt" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_mswsock" "-lwinapi_ntdll" "-lwinapi_opengl32" "-lwinapi_user32" "-lwinapi_winspool" "-lwinapi_ws2_32" "-lwindows" "-lkernel32" "-lws2_32" "-lbcrypt" "-ladvapi32" "-luserenv" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-nostartfiles" "-L" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-L" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\self-contained" "-o" "C:\\Users\\sahil\\CLionProjects\\coc-rs\\target\\debug\\deps\\coc_rs-6b97e9afad26cc80.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlibs" "C:\\Users\\sahil\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: ld: cannot find -lntdll

Solution

  • This is a known bug which should have been by the resolution for another issue.

    Just update by rustup update or by any package manager you installed the toolchain.