Regressions in Nightly / Beta on Windows

Hi everyone,

I'm one of the maintainers of liboqs, an open-source C library for post-quantum cryptography. One of our other projects is a Rust wrapper for the library. We run tests in CI on Linux / Mac / Windows with Stable / Beta / Nightly Rust.

Some time ago, our Windows / Nightly builds started failing with what appears to be a linker error. I am fairly certain that this is due to a change in Rust, as CI had previously passed on the same commit, and I don't believe there were any GitHub runner updates. The same error is now causing our Beta Rust builds to fail. These had previously passed, which seems to confirm that it is indeed a change in Rust triggering the failure.

I am unfortunately out of my depth when dealing with the intricacies of Rust and Windows, so I'm hoping that maybe this is a known error and that somebody here will have insight (or can at least point me toward the right place to ask this question).

Here is the detailed error message (also linked above):

error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustchMnDTj\\symbols.o" "<9 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libtest-*,libgetopts-*,libunicode_width-*,librustc_std_workspace_std-*}.rlib" "D:\\a\\liboqs-rust\\liboqs-rust\\target\\debug\\deps/{liboqs_sys-332d94876817d713.rlib,liblibc-124eb4bee469bbec.rlib}.rlib" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,libcfg_if-*,liballoc-*,librustc_std_workspace_core-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "C:/Program Files/OpenSSL\\lib\\libcrypto.lib" "D:\\a\\liboqs-rust\\liboqs-rust\\target\\debug\\build\\oqs-sys-c82817a9d50dfd24\\out\\lib\\oqs.lib" "legacy_stdio_definitions.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/LIBPATH:C:/Program Files/OpenSSL\\lib" "/LIBPATH:D:\\a\\liboqs-rust\\liboqs-rust\\target\\debug\\build\\oqs-sys-c82817a9d50dfd24\\out\\lib" "/LIBPATH:D:\\a\\liboqs-rust\\liboqs-rust\\target\\debug\\build\\oqs-sys-c82817a9d50dfd24\\out\\lib64" "/OUT:D:\\a\\liboqs-rust\\liboqs-rust\\target\\debug\\deps\\oqs-5ff10ce6b35c7119.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis" "/STACK:20971520"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note:    Creating library D:\a\liboqs-rust\liboqs-rust\target\debug\deps\oqs-5ff10ce6b35c7119.lib and object D:\a\liboqs-rust\liboqs-rust\target\debug\deps\oqs-5ff10ce6b35c7119.exp␍
          LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library␍
          oqs.lib(rand.obj) : error LNK2019: unresolved external symbol __imp_CryptAcquireContextA referenced in function OQS_randombytes_system␍
          oqs.lib(rand.obj) : error LNK2019: unresolved external symbol __imp_CryptReleaseContext referenced in function OQS_randombytes_system␍
          oqs.lib(rand.obj) : error LNK2019: unresolved external symbol __imp_CryptGenRandom referenced in function OQS_randombytes_system␍
          D:\a\liboqs-rust\liboqs-rust\target\debug\deps\oqs-5ff10ce6b35c7119.exe : fatal error LNK1120: 3 unresolved externals␍

If looks like it's beta-x86_64-pc-windows-msvc with rustc 1.87.0-beta.5 (386abeb93 2025-04-19), still failing with rustc 1.87.0-beta.7 (9d6fe3d1b 2025-04-28).

Wouldn't that be something to report in the Rust GitHub? Of course, it's a beta, but I suppose the idea is to warn about a potentially difficult-to-detect regression before it makes it into stable.

1 Like

Thanks for the suggestion. I will follow up there.

Check the release notes for the upcoming stable version, they have the instructions for how to fix this.

2 Likes