Fix zstd install rules breaking clr.runtime clean build#125063
Merged
rzikm merged 2 commits intodotnet:mainfrom Mar 6, 2026
Merged
Fix zstd install rules breaking clr.runtime clean build#125063rzikm merged 2 commits intodotnet:mainfrom
rzikm merged 2 commits intodotnet:mainfrom
Conversation
Use add_subdirectory with EXCLUDE_FROM_ALL instead of FetchContent to prevent zstd's own install() rules from being included in the build's install step. Without this, building clr.runtime from a clean build fails because the install step tries to install zstd_static.lib which was not built as part of the runtime target. Fixes dotnet#124234 Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the vendored zstd CMake integration to avoid zstd’s upstream install() rules being pulled into the clr.runtime component install, which can fail in clean subset builds when zstd’s static library was never built.
Changes:
- Replaces
FetchContentusage insrc/native/external/zstd.cmakewith a directadd_subdirectory(... EXCLUDE_FROM_ALL)call. - Adds rationale comments explaining the
clr.runtimeclean-build install failure and whyEXCLUDE_FROM_ALLis used.
Co-authored-by: Copilot <[email protected]>
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/runtime-infrastructure |
This was referenced Mar 5, 2026
Open
jkoritzinsky
approved these changes
Mar 5, 2026
Member
Author
|
/ba-g Test failures are unrelated |
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.
Summary
Fix CMake build failure when building
clr.runtimefrom a clean build (instead ofclr.native).Problem
When building
clr.runtimefrom clean, the install step fails with:This happens because zstd's own
install()rules are included in the build's install step. When theruntimecomponent install runs, it tries to installzstd_static.lib— but that file was never built becauselibzstd_staticis only built as a dependency ofSystem.IO.Compression.Native, which is not part of theruntimebuild target.Fix
Replace
FetchContentwith a directadd_subdirectory()call usingEXCLUDE_FROM_ALL, which reliably prevents zstd's owninstall()rules from being included in the component install. TheEXCLUDE_FROM_ALLparameter onadd_subdirectory()has properly suppressed install rules since CMake 3.14, making it compatible with the project's CMake 3.26 minimum.The explicit
install()calls inSystem.IO.Compression.Native/CMakeLists.txtthat installlibzstd_staticto the correct destinations continue to work as before since they target thelibzstd_statictarget directly (not via zstd's own install rules).Fixes #124234