Repository navigation
Fix CMake 4.2.0+ build failure for nativeaot bootstrapper - #122152
Merged
Merged
Conversation
…or bootstrapper OBJECT library
CMake 4.2.0 changed the default location where PDB files for OBJECT libraries are placed.
Without explicitly setting COMPILE_PDB_OUTPUT_DIRECTORY, the PDB ends up in
CMakeFiles/<target>.dir/ instead of the expected location.
This change sets COMPILE_PDB_OUTPUT_DIRECTORY to ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>
and updates the install path to consistently use $<CONFIG>, matching the pattern
used in other OBJECT libraries like eventpipe-shared-objects.
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CMake build errors with latest version
Fix CMake 4.2.0+ build failure for nativeaot bootstrapper
Dec 3, 2025
This was referenced Dec 4, 2025
Open
ericstj
approved these changes
Dec 4, 2025
ericstj
left a comment
Member
There was a problem hiding this comment.
I pulled this fix locally and it did resolve it for me. I'm building on Windows with Dev18.
Member
|
@ericstj Thanks for the validation. This change LGTM, but as I said I'm not a CMake expert. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a build failure with CMake 4.2.0+ by updating the nativeaot bootstrapper's PDB file handling to accommodate CMake's changed default PDB location for OBJECT libraries.
Key changes:
- Set
COMPILE_PDB_OUTPUT_DIRECTORYto explicitly place PDB files in the expected$<CONFIG>subdirectory - Unified the install path to consistently use
$<CONFIG>for all MSVC generators, removing the Visual Studio vs. Ninja conditional
jkoritzinsky
approved these changes
Dec 5, 2025
jkoritzinsky
left a comment
Member
There was a problem hiding this comment.
As the resident CMake expert (or closest we have to it) LGTM
Member
|
/ba-g Helix infra issue |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes Issue
main PR
Description
CMake 4.2.0 changed the default PDB location for OBJECT libraries from
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/toCMakeFiles/<target>.dir/, causing install step failures when the build system couldn't findbootstrapper.pdb.Changes:
COMPILE_PDB_OUTPUT_DIRECTORYto"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>"for bootstrapper OBJECT library$<CONFIG>for all MSVC generators (removed Visual Studio vs. Ninja conditional)Follows existing pattern from
eventpipe-shared-objectsOBJECT library.Customer Impact
Builds fail completely with CMake 4.2.0-rc4+ on Windows. Developers cannot build the repo with latest CMake versions, blocking contribution and testing.
Regression
No. This is a new failure introduced by CMake 4.2.0's behavior change, not a regression in runtime code.
Testing
Build configuration change validated against:
eventpipe-shared-objectsOBJECT libraryCOMPILE_PDB_OUTPUT_DIRECTORYpropertyRisk
Low. Minimal change affecting only Windows MSVC builds of OBJECT libraries in nativeaot bootstrapper. No code logic changes, only CMake build configuration to adapt to CMake 4.2.0's new intermediate directory strategy.
Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.