Repository navigation
Get MSVC dependencies from a vcpkg manifest - #439
Merged
Merged
Conversation
zlib 1.4 renamed its MSVC import library to libz.lib, which broke the hard-coded zlib.lib references in the Visual Studio projects. Add a vcpkg.json manifest (libiconv, zlib; optional features csv and xlsx) with a pinned builtin-baseline, enable manifest mode in PropertySheet.props, and drop the hard-coded library names and paths from the projects. The vcpkg MSBuild integration now provides headers, import libraries and DLLs. In CI, check out the runner's vcpkg at the manifest baseline, build only release dependencies, and key the binary cache on vcpkg.json; the library renaming step is no longer needed. Also run ReadStat_Test_readstat from the repository root in Visual Studio, since the tests open resources/* relative to the working directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The Windows MSVC build is seemingly flaky at the moment. The root cause is that zlib renamed its library file names for MSVC in the 1.4 release. And the build now fails on runners with a more recent
vcpkgsetup with zlib 1.4, and succeeds on runners with an oldervcpkgsetup.The build currently works through a workflow step that copies libraries to the names the Visual Studio project expects. This step would need changes to reflect the zlib upgrade. And the project contains hard-coded paths such as
C:\vcpkg\...and..\..\..\iconv\lib64, which only works on particular setups.Instead of adjusting the file copy step, I think it's a better idea to fully switch to a vcpkg setup also in the VS project itself. This also provides a much better developer experience as the project now automatically handles the dependencies. I tested this in the Visual Studio 2026 Community Edition, and I think creating a working setup for ReadStat on Windows is much simpler with this change.
The fixed vcpkg version has the benefit that the build is more reproducible and no longer fails on changes like in zlib 1.4. But it comes at the cost that the baseline should be actively bumped from time to time. I've added a section to the README how this works.
What
vcpkg.jsonmanifest at the repository root that lists libiconv and zlib. A pinned baseline keeps the library versions the same for local and CI builds. Optional csv and xlsx features cover the extra command-line tool features.vcpkg.json.Testing
I built all four configurations (Debug/Release × Win32/x64) in Visual Studio 2026 Community, and the tests pass.