Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## [Unreleased]

## [0.3.16] (2026-07-12)

### Fixed

* Windows/MSVC vcpkg builds: emit `cargo:rustc-link-lib=bcrypt` and `ws2_32`
alongside the vcpkg-resolved libraries. vcpkg 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 a static `libxml2.lib`
into any real target (proc-macro dylib, bin, test) failed with LNK2019.
Both import libraries ship with every MSVC/Windows SDK toolchain.

## [0.3.15] (2026-07-06)

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libxml"
version = "0.3.15"
version = "0.3.16"
edition = "2024"
rust-version = "1.88"
authors = ["Andreas Franzén <andreas@devil.se>", "Deyan Ginev <deyan.ginev@gmail.com>","Jan Frederik Schaefer <j.schaefer@jacobs-university.de>"]
Expand Down
11 changes: 11 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ mod vcpkg_dep {
use crate::ProbedLib;
pub fn vcpkg_find_libxml2() -> Option<ProbedLib> {
if let Ok(metadata) = vcpkg::Config::new().find_package("libxml2") {
// vcpkg emits link directives for the port's own libraries and its
// port dependencies (iconv, zlib, ...), but NOT for Windows SDK
// system libraries, which are Libs.private in libxml-2.0.pc:
// libxml2 >= 2.12 calls BCryptGenRandom (xmlInitRandom, dict.c), so
// a static libxml2.lib leaves that symbol unresolved unless we link
// bcrypt ourselves. ws2_32 likewise backs the (default-on) nanohttp
// code. Both import libraries ship with every MSVC/Windows SDK
// toolchain, so linking them unconditionally here is safe even for
// vcpkg builds configured without those features.
println!("cargo:rustc-link-lib=bcrypt");
println!("cargo:rustc-link-lib=ws2_32");
let include_paths = metadata
.include_paths
.into_iter()
Expand Down
Loading