Fix Build Failure Due to Nsync Not Being Found Correctly #20980
Closed
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
When fetching nsync via FetchContent_Declare, force it to be downloaded instead of attempting to find an installed CMake package first.
Motivation and Context
While nsync 1.26 and lower did not export CMake targets, versions from 1.27 onwards do. Also, some package maintainers chose to create CMake targets as part of their distribution for previous versions. If these are installed on the user's system, onnxruntime will currently fail to build. This is because onnxruntime is incompatible with these targets and instead expects the library to be provided as a subdirectory in the _deps folder. Preventing cmake from searching system paths for the targets solves this build failure.
This is the error I was getting:
I think the planned solution had been #20413, but it looks like it was too difficult to remove nsync without affecting existing functionality.