Skip to content

Commit acf0b8f

Browse files
authored
Add rust build link dependencies (#5854)
## Description Fixes the Rust CI failures ### AI diagnostic Root Cause: Accidental Transitive Dependency Cargo.lock is .gitignore'd, so every CI run resolves the latest compatible dependency versions. Between Mar 5 and Mar 6: 1. socket2 updated 0.6.2 → 0.6.3, which bumped windows-sys from 0.60.2 → 0.61.2 2. windows-sys 0.60.x depended on windows_x86_64_msvc — a crate that ships actual .lib import library files (advapi32.lib, crypt32.lib, iphlpapi.lib, etc.) and makes them available to the linker 3. windows-sys 0.61.x switched to windows-link with raw-dylib, which generates import stubs inline — dropping windows_x86_64_msvc entirely 4. The msquic build.rs never declared its Windows system library dependencies — they were accidentally satisfied by windows_x86_64_msvc's import libraries being on the linker search path 5. With that crate gone, msquic.lib's references to advapi32, crypt32, etc. became unresolved ## Testing CI ## Documentation N/A
1 parent 45a46f3 commit acf0b8f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/build.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,20 @@ fn cmake_build() {
9090
} else if cfg!(target_os = "macos") {
9191
println!("cargo:rustc-link-lib=framework=CoreFoundation");
9292
println!("cargo:rustc-link-lib=framework=Security");
93+
} else if cfg!(windows) {
94+
// Windows system libraries that the static msquic.lib depends on.
95+
// These are excluded from the monolithic archive (via the inc/base_link
96+
// EXCLUDE_LIST in CMake) and must be linked explicitly by the consumer.
97+
for lib in [
98+
"ws2_32", "ntdll", "bcrypt", "ncrypt", "crypt32", "iphlpapi", "advapi32",
99+
"schannel",
100+
] {
101+
println!("cargo:rustc-link-lib={lib}");
102+
}
103+
if cfg!(feature = "openssl") || cfg!(feature = "quictls") {
104+
// OpenSSL references user32 symbols (MessageBoxW, etc.)
105+
println!("cargo:rustc-link-lib=user32");
106+
}
93107
}
94108
}
95109
}

0 commit comments

Comments
 (0)