-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HybridGlobalization] Fix xamarin_macios build after system ICU change #96270
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vargaz Do you think this block is also unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be needed, those defines are not set in that project. I think the issues is that in some cases these files are compiled as part of the mono runtime, and sometimes they are compiled into a separate lib ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when I build runtime locally I see that we compile the globalization code twice:
src/native/System.Globalization.Native
That is why I don't see any failure on runtime, but
xamarin-macios
maybe is takingsrc/native/System.Globalization.Native
compiled into separate lib.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how is it possible for xamarin to skip cmake inclusions needed to build this cmake list? These TARGET_XX variables are defined in
eng/native/configurecompiler.cmake
along with many compiler flags, andconfigurecompiler
is ultimately included by this cmake list. If xamarin is skippingconfigurecompiler
include somehow (which seems unlikely), then fixing it this way won't be enough as it will break something else. We should fix xamarin build instead so it builds the runtime's native lib subset properly as intended; with the entire cmake include chain.cc @jkoritzinsky, @akoeplinger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xamarin/xamarin-macios doesn't build anything from dotnet/runtime, we consume the static/dynamic libraries dotnet/runtime ships. The problem is that those libraries aren't built correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In xamarin-macios, dotnet/runtime artifacts are consumed in two different ways:
For some scenarios a single
libmonosgen-2.0.dylib
is consumed: this file is built fromsrc/mono/mono/mini/CMakeLists.txt
and it includes a copy of System.Native.Globalization. This version of the globalization code is built by these rules: https://github.com/dotnet/runtime/blob/main/src/mono/mono/mini/CMakeLists.txt#L59-L111. and is consumed here:runtime/src/mono/mono/mini/CMakeLists.txt
Lines 429 to 431 in 806c365
In this case the cmake defines that are floating around are coming from how the mono runtime is configured (which does not yet use
configurecompiler.cmake
andconfigureplatform.cmake
).For some scenarios xamarin-macios instead consumes a collection of static libraries:
libmono-sgen-2.0.a
,libSystem.Globalization.Native.a
,libmono-component-debugger.a
etc. In this caselibSystem.Globalizaiton.Native.a
is built fromsrc/native/libs/CMakeLists.txt
which includesconfigureplatform.cmake
, but does not include the plethora of Mono definitions.On the other hand, the C source files comprising
src/native/libs/System.Globalization.Native
depend on defines likeTARGET_MACCATALYST
that are part of the mono build, but weren't yet part of the build for the staticlibSystem.Globalization.Native.a
.By the way @mkhamoyan there's similar logic in https://github.com/dotnet/runtime/blob/main/src/native/libs/System.Security.Cryptography.Native.Apple/CMakeLists.txt#L60-L70. Maybe it would make more sense to move it up to
src/libs/native/CMakeLists.txt
or to some common.cmake
fragment, instead?Also - I'm not sure why we link the icu shim directly into
libmonosgen-2.0.dylib
- I'm pretty sure we don't do that with crypto, but we can apparently still ensure that the symbols are available at runtime so that all the pinvokes can find them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think that this is correct. These defines are defined in
configurecompiler.cmake
too. For example,TARGET_MACCATALYST
is defined at https://github.com/dotnet/runtime/blob/main/eng/native/configurecompiler.cmake#L697 .I expect that we are going to find that this fix is not addressing the xamarin-macios build break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I agree now, I don't see how this change would fix anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think it addresses it either. @mkhamoyan pointed this out to me earlier today in that the xamarin build may need to be modified because only a subset of the pinvokes will be active since we are shipping with hybrid globalization always on. We plan on adding the ability to turn it off and use our ICU in a later change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverting this PR #96658