From 75d5de36f49cfb5cf43ddd87a58a57c3741b724a Mon Sep 17 00:00:00 2001 From: Nicolas Torneri Date: Tue, 28 Oct 2025 13:26:08 +0100 Subject: [PATCH 1/3] fix linker libraries for x86_64-pc-windows-gnu target --- libssh-rs-sys/build.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libssh-rs-sys/build.rs b/libssh-rs-sys/build.rs index b9aea88..f42885c 100644 --- a/libssh-rs-sys/build.rs +++ b/libssh-rs-sys/build.rs @@ -260,8 +260,15 @@ fn main() { cfg.compile("libssh"); if target.contains("windows") { - println!("cargo:rustc-link-lib=libcrypto"); - println!("cargo:rustc-link-lib=libssl"); + if target.contains("windows-msvc") { + // target `windows-msvc` expects `lib` prefix + println!("cargo:rustc-link-lib=libcrypto"); + println!("cargo:rustc-link-lib=libssl"); + } else { + // target `windows-gnu` adds the `lib` prefix + println!("cargo:rustc-link-lib=crypto"); + println!("cargo:rustc-link-lib=ssl"); + } println!("cargo:rustc-link-lib=crypt32"); println!("cargo:rustc-link-lib=user32"); println!("cargo:rustc-link-lib=shell32"); From 18858f3e000cbee2761a6ef10031cfedbd62f62b Mon Sep 17 00:00:00 2001 From: Nicolas Torneri Date: Tue, 28 Oct 2025 14:43:37 +0100 Subject: [PATCH 2/3] set windows version to latest on ci --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 31587a0..9ce721f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2019] + os: [windows-latest] env: - TARGET: x86_64-pc-windows-msvc - TARGET: i686-pc-windows-msvc From 7c8457372ea882bdf71713fe8558ff038246eb98 Mon Sep 17 00:00:00 2001 From: Nicolas Torneri Date: Thu, 6 Nov 2025 09:47:55 +0100 Subject: [PATCH 3/3] add missing advapi32 library for windows-msvc builds --- libssh-rs-sys/build.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/libssh-rs-sys/build.rs b/libssh-rs-sys/build.rs index f42885c..b1551d2 100644 --- a/libssh-rs-sys/build.rs +++ b/libssh-rs-sys/build.rs @@ -269,6 +269,7 @@ fn main() { println!("cargo:rustc-link-lib=crypto"); println!("cargo:rustc-link-lib=ssl"); } + println!("cargo:rustc-link-lib=advapi32"); println!("cargo:rustc-link-lib=crypt32"); println!("cargo:rustc-link-lib=user32"); println!("cargo:rustc-link-lib=shell32");