Repository navigation
Accept an installed Microsoft.GSL 5 - #33302
Open
Joel Kiptoo (Kiptoo-Deus) wants to merge 2 commits into
Open
Joel Kiptoo (Kiptoo-Deus) wants to merge 2 commits into
Joel Kiptoo (Kiptoo-Deus) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The exported static package configuration still rejects GSL 5.x consumers.
1 open finding
What changed in this PR
Allows installed Microsoft.GSL 5.x packages while enforcing GSL 4.0 as the minimum.
Changes:
- Removes the major-version-constrained package lookup.
- Adds an explicit minimum-version check.
| File | Description |
|---|---|
cmake/external/onnxruntime_external_deps.cmake |
Updates GSL discovery and version validation. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL | ||
| # Microsoft.GSL's version file only accepts the same major version, so no | ||
| # version is requested here and the minimum is checked below. | ||
| FIND_PACKAGE_ARGS NAMES Microsoft.GSL |
7 tasks done
This branch has not been deployed
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.

Description
The GSL dependency is declared with
FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL. Microsoft.GSL writes its config version file withSameMajorVersion, so an installed GSL 5.x (5.0.0 released August 2026) never matches. This change requests no version inFIND_PACKAGE_ARGSand checks the minimum afteronnxruntime_fetchcontent_makeavailable(GSL).Motivation and Context
When an installed GSL 5 is present:
FETCHCONTENT_FULLY_DISCONNECTED, as in vcpkg), configuration fails at the static-libraryinstall(TARGETS GSL ...)with "install TARGETS given target "GSL" which does not exist".The second case is what broke the onnxruntime port in microsoft/vcpkg#54418 (updating ms-gsl to 5.0.1). With the same
FIND_PACKAGE_ARGSchange applied to 1.23.2 there, onnxruntime builds against GSL 5.0.1 in vcpkg CI.I checked the CMake logic in a small project that reproduces this
FetchContent_Declareblock, with these installed GSL versions:The installed package config for static builds had the same problem:
cmake/CMakeLists.txtwritesfind_dependency(Microsoft.GSL 4.0), so a static ONNX Runtime built against GSL 5 could not be found by consumers. It now writesfind_dependency(Microsoft.GSL)followed by the same 4.0 minimum check, which setsonnxruntime_FOUNDto false with that message. I generated the config through the samefile(WRITE)/configure_package_config_filepath and loaded it withfind_package(onnxruntime CONFIG): found with GSL 5.0.1 and 4.2.2, not found with GSL 3.1.0 (message shown).The one behavior change is an installed GSL older than 4.0: it used to be skipped in favour of the bundled copy and now stops with that error.
Separately, GSL 5.0.0 includes microsoft/GSL#1213, so
patches/gsl/1213.patchcould be dropped when the bundled GSL is moved to 5.x. That isn't part of this change.