Reputation: 271
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:
Upvotes: 7
Views: 7209
Reputation: 1072
It is not the exact answer to your problem but another way to cross-compile and a very simple one is using cargo-cross. Steps:
Instructions and usage in https://github.com/cross-rs/cross/blob/main/docs/getting-started.md
Upvotes: -1
Reputation: 785
Find where MinGW is installed. I have mine in C:\msys64
as part of MSYS2 installation.
In the root of your Rust project create a .cargo
folder.
Inside the .cargo
folder, create a config.toml
file with the following content (adjust for MinGW installation path in your system):
[target.x86_64-pc-windows-gnu]
linker = "C:\\msys64\\mingw64\\bin\\gcc.exe"
ar = "C:\\msys64\\mingw64\\bin\\ar.exe"
cargo build
or cargo run
Upvotes: 0
Reputation: 2495
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.
Upvotes: 2