-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
WIP: Build CoreCLR for Mac Catalyst OS #51000
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
@janvorli Do you think you could help Jo figure out what may be wrong? |
@directhex the "Recursion in CLRException::GetThrowable" error means that when attempting to create an exception object, another exception occurred. There can be many reasons for that - missing assembly with the type of the exception to be thrown is one of them. Would you be able to run it under lldb to see the call stack and possibly some more details? |
|
@janvorli any clues in the above from lldb? |
@directhex I am sorry, I've missed your comment with the stack trace before. So the CorHost2::ExecuteAssembly called Assembly::ExecuteMainMethod, which has resulted in a thrown managed exception somewhere. The runtime then tried to log the unhandled exception to console, but attempt to call ToString on the Exception resulted in a failure and an attempt to throw another exception somewhere during an attempt to JIT or get R2R code for a managed method. To debug the issue, I'd recommend using SOS plugin so that you can dump stack trace including managed methods and also some managed objects if needed. Here is a guide on how to install SOS: https://github.com/dotnet/diagnostics/blob/main/documentation/installing-sos-instructions.md |
4857326
to
0fe63e3
Compare
|
If I'm reading that correctly, it looks like I might have stubbed things out too hard in the vicinity of ICU. |
It looks like that. You may be able to workaround it by using invariant globalization mode (https://github.com/dotnet/runtime/blob/01b7e73cd378145264a7cb7a09365b41ed42b240/docs/design/features/globalization-invariant-mode.md), which doesn't use ICU. |
Success, now it "successfully" fails! OK, now to see if invariant mode helps with Xunit |
Uh... okay then, corerun :| |
0fe63e3
to
b697a83
Compare
I haven't even changed anything, but today, it works less than it did last week.
|
I haven't made anything actually work but at least now anyone can repro, with |
If you feel spicy, you can add |
Possibly to actually have the entitlements have any effect, you also need the hardened runtime option |
This should now be working end-to-end locally, i.e. Not plumbed into AzDO as of yet, but should work locally |
"RUNTIME_IDENTIFIER", | ||
"APP_CONTEXT_BASE_DIRECTORY", | ||
#if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST | ||
"ICU_DAT_FILE_PATH" | ||
#endif | ||
}; | ||
const char *appctx_values [] = { | ||
APPLE_RUNTIME_IDENTIFIER, | ||
bundle, | ||
#if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST | ||
icu_dat_path | ||
#endif | ||
}; |
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 don't think it would hurt anything to add these to propertyKeys/propertyValues. they're literally the same thing.
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.
It wasn't really a conscious design decision not to. I took the Mono runtime.m, deleted all Mono-specific lines, and added lines to make CoreCLR work. I guess this ended up as vestigial.
@@ -186,6 +199,7 @@ public Xcode(string target, string arch) | |||
cmakeLists = cmakeLists.Replace("%NativeLibrariesToLink%", toLink); | |||
cmakeLists = cmakeLists.Replace("%AotSources%", aotSources); | |||
cmakeLists = cmakeLists.Replace("%AotModulesSource%", string.IsNullOrEmpty(aotSources) ? "" : "modules.m"); | |||
cmakeLists = cmakeLists.Replace("%RpathResources%", "coreclr".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase) ? "TRUE" : "FALSE"); |
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.
It probably wouldn't hurt anything to do this for mono, also.
…oise in CI" This reverts commit a03399d.
@directhex should we close this one or do you want to land some common changes? |
This is at a proof-of-concept stage, for wider discussion.
Mac Catalyst is Apple's approach towards multi-platform development: essentially, it allows building iPhone/iPad/AppleTV apps (using the iOS/tvOS API) as desktop macOS apps. For example, on Big Sur, the News app bundled with the OS is a Mac Catalyst app.
.NET 6 features support for Mac Catalyst, using the Mono runtime (as Mono already supports iOS, the incremental work to make Mono work on Mac Catalyst is minimal).
However, because our recommendation to users is that they use CoreCLR for desktop and server workloads, I've been tasked with moving Mac Catalyst onto CoreCLR.
I've had to stub out a bunch of critical stuff in this PR, and there are manual steps needed to make it work which I haven't plumbed into the build system (largely around using
codesign --entitlements
to permit the corerun binary to do JITting), but I have Hello World running at the very least:Some stuff, on the other hand, I don't have working:
I don't have much experience with CoreCLR internals, so I'd welcome any suggestions as to where to head next in getting this in slightly better shape