Skip to content

vcpkg: link Windows SDK system libs (bcrypt, ws2_32)#209

Merged
dginev merged 2 commits into
mainfrom
windows-compatibility
Jul 12, 2026
Merged

vcpkg: link Windows SDK system libs (bcrypt, ws2_32)#209
dginev merged 2 commits into
mainfrom
windows-compatibility

Conversation

@dginev

@dginev dginev commented Jul 12, 2026

Copy link
Copy Markdown
Member

The vcpkg arm emits link directives for the port's libraries and port dependencies, but not for Windows SDK system libraries (Libs.private in libxml-2.0.pc). libxml2 >= 2.12 calls BCryptGenRandom from xmlInitRandom, so linking the static libxml2.lib into any real target (proc-macro dylib, bin, test) fails with LNK2019; ws2_32 likewise backs nanohttp. Both import libraries ship with every MSVC toolchain, so linking them unconditionally in the vcpkg arm is safe.

Witnessed in latexml-oxide's Windows port (first surfaced in a proc-macro dylib link, since cargo check of rlibs never links).

dginev and others added 2 commits July 12, 2026 15:00
The vcpkg crate emits link directives for the port's libraries and port
dependencies, but not for Windows SDK system libraries (Libs.private in
libxml-2.0.pc). libxml2 >= 2.12 calls BCryptGenRandom from xmlInitRandom
(dict.c), leaving an unresolved external when linking the static
libxml2.lib into a proc-macro/bin/test target; ws2_32 likewise backs
nanohttp. Both import libs ship with every MSVC toolchain.

Witnessed in latexml-oxide's Windows port: LNK2019 BCryptGenRandom in
latexml_codegen's proc-macro dylib link.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dginev dginev merged commit a131895 into main Jul 12, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant