Skip to content

error: linking with x86_64-w64-mingw32-gcc failed: exit code: 1 #91146

@insinfo

Description

@insinfo

i'm trying to compile on windows and i get this error , on Windows 11

PS C:\MyRustProjects\fsbackup_engine> cargo clean
PS C:\MyRustProjects\fsbackup_engine> cargo build
   Compiling whoami v1.2.0
   Compiling fsbackup_engine v0.1.0 (C:\MyRustProjects\fsbackup_engine)
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:\\rust\\toolchains\\stable-x86_64-pc-win
dows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\self-contained\\crt2.o" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "C:\
\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.1pt9prttv128uo2j.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engin
e-d32542f439e80aee.1ruhj7kwh7vzv8d9.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.2kon509fe5wo3oop.rcgu.o" "C:\\MyRustProjects\\fsba
ckup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.2pfaf41ga7eblwlz.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.34
jri740lrs3thiq.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.3kt0bao5o8x0lxlh.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\
debug\\deps\\fsbackup_engine-d32542f439e80aee.42xpqzv6kez0il64.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.4xk7yxj5pa0x9lip.rcgu.o
" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.568xwdd21d5x67h1.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup
_engine-d32542f439e80aee.56iitxaeizf5c8nz.rcgu.o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.tobg70orvraksrv.rcgu.o" "C:\\MyRustProjects\
\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.2kunw55j7bwqfbnb.rcgu.o" "-L" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps" "-L" "C:\\windows\\system
32" "-L" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,--start-group" "-Wl,-Bstatic" "C:\\rust\\toolchains\\stable-x86_64-pc-windows
-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-c949a5d9f8ea17eb.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwi
nd-4efbd26dc95f473b.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libobject-11df657f271ec0b5.rlib" "C:\\rust\\toolchains\\stable-x8
6_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libmemchr-ed6e817a89285a21.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\
lib\\libaddr2line-a16c4de5bb48a9a6.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgimli-b5d4a31ea91f9e86.rlib" "C:\\rust\\toolcha
ins\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_detect-01e22831e506e0c6.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_6
4-pc-windows-gnu\\lib\\librustc_demangle-85865d75ad690c5e.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-91e2696c8ccb44
61.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-186512436a4043bc.rlib" "C:\\rust\\toolchains\\stable-
x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-d0f4aee65f54d86f.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu
\\lib\\libcfg_if-42335e6cb2553e87.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-662baf24e2595e01.rlib" "C:\\rust\\toolchain
s\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-131219d6deabaad8.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-wi
ndows-gnu\\lib\\librustc_std_workspace_core-6530d4af942dc9d4.rlib" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-d1ec034e2d5fe483
.rlib" "-Wl,--end-group" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-885492184211f20a.rlib" "-Wl,-Bdynamic" "-lker
nel32" "-lws2_32" "-ladvapi32" "-luserenv" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-nost
artfiles" "-L" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-L" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_
64-pc-windows-gnu\\lib\\self-contained" "-o" "C:\\MyRustProjects\\fsbackup_engine\\target\\debug\\deps\\fsbackup_engine-d32542f439e80aee.exe" "-Wl,--gc-sections" "-no-pie" "-nodefaultlib
s" "C:\\rust\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: C:\rust\toolchains\stable-x86_64-pc-windows-gnu\lib\rustlib\x86_64-pc-windows-gnu\lib\self-contained\crt2.o:crtexe.c:(.text+0x2a0): undefined reference to `_set_invalid_paramet
er_handler'

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-li
bkindname)

error: could not compile `fsbackup_engine` due to previous error
PS C:\MyRustProjects\fsbackup_engine>

fn main() {
    println!("Hello, world! {}","sdf");
}

Expected behavior

compile without errors

rustc --version --verbose:

PS C:\MyRustProjects\fsbackup_engine> rustc --version --verbose
rustc 1.56.1 (59eed8a2a 2021-11-01)
binary: rustc
commit-hash: 59eed8a2aac0230a8b53e89d4e99d55912ba6b35
commit-date: 2021-11-01
host: x86_64-pc-windows-gnu
release: 1.56.1
LLVM version: 13.0.0

PS C:\MyRustProjects\fsbackup_engine> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\rust

installed toolchains
--------------------

stable-x86_64-pc-windows-gnu (default)
stable-x86_64-pc-windows-msvc

active toolchain
----------------

stable-x86_64-pc-windows-gnu (default)
rustc 1.56.1 (59eed8a2a 2021-11-01)

PS C:\MyRustProjects\fsbackup_engine>


[package]
name = "fsbackup_engine"
version = "0.1.0"
edition = "2018"

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

[dependencies]
#ssh2 = "0.9.0" # Bindings to libssh2 for interacting with SSH servers and executing remote commands
whoami = "1.1.1" # Retrieve the current user and environment.
#toml = "0.5.8" # A native Rust encoder and decoder of TOML-formatted files and streams.
#rand = "0.8.4" # Random number generators and other randomness functionality.
#regex = "1.5.4"
#lazy_static = "1.4.0"
#log = "0.4.14"
#bytesize = "1.1.0"
#chrono = "0.4.19"
#wildmatch = "2.0.0"
#thiserror = "^1.0.0"

#[target."cfg(target_family = \"unix\")"]
#[target."cfg(target_family = \"unix\")".dependencies]
#users = "0.11.0"

#[target."cfg(target_os = \"windows\")"]
#[target."cfg(target_os = \"windows\")".dependencies]
#path-slash = "0.1.4"

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windows-gnuToolchain: GNU, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions