Skip to content
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

Add support for building CoreCLR for iOS/tvOS simulator #89673

Closed
wants to merge 20 commits into from

Conversation

filipnavara
Copy link
Member

@filipnavara filipnavara commented Jul 29, 2023

Build instructions:

  • Build the runtime pack with ./build.sh clr+clr.nativeaotlibs+libs+packs -os [iossimulator/tvossimulator/maccatalyst] -arch arm64 -cross
  • Run the sample app in iOS simulator: ./dotnet.sh publish src/mono/sample/iOS/Program.csproj -c Release /p:TargetOS=iossimulator /p:TargetArchitecture=arm64 /p:DeployAndRun=true /p:UseMonoRuntime=false /p:RunAOTCompilation=false /p:MonoForceInterpreter=false

SDK would need to be updated with RIDs in KnownRuntimeFramework to use this. Xamarin counterpart for bindings support: https://github.com/xamarin/xamarin-macios/compare/net8.0...filipnavara:xamarin-macios:net8.0-coreclr-ioslike?expand=1

To do:

  • Add documentation
  • Cleanup
  • Fix RegisterToggleRef in Xamarin
  • Check and fix x64 builds (src/native/minipal/cpufeatures.c is broken in cross-build from arm64 -> x64 because it tries to use target's assembler, and for some reason CLR_CROSS_COMPONENTS_BUILD doesn't trigger its exclusion)
  • Fix running iossimulator-x64 sample on arm64 (AppleAppBuilder produces XCode project with wrong arch)
  • Package the static libcoreclr_static.a
  • Fix runtime test builds

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jul 29, 2023
@ghost
Copy link

ghost commented Jul 29, 2023

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

Build instructions:

  • Build the runtime pack with ./build.sh clr+clr.nativeaotlibs+libs+packs -os [iossimulator/tvossimulator/maccatalyst/ios] -arch arm64 -cross
  • Run the sample app in iOS simulator: dotnet publish src/mono/sample/iOS/Program.csproj -c Release /p:TargetOS=iossimulator /p:TargetArchitecture=arm64 /p:AppleAppBuilderRuntime=CoreCLR /p:DeployAndRun=true /p:UseMonoRuntime=false /p:RunAOTCompilation=false /p:MonoForceInterpreter=false

SDK would need to be updated with RIDs in KnownRuntimeFramework to use this. Xamarin counterpart for bindings support: https://github.com/xamarin/xamarin-macios/compare/net8.0...filipnavara:xamarin-macios:net8.0-coreclr-ioslike?expand=1

To do:

  • Add documentation
  • Cleanup
Author: filipnavara
Assignees: -
Labels:

area-Infrastructure-coreclr, community-contribution

Milestone: -

@filipnavara
Copy link
Member Author

Obligatory screenshot:
image

@filipnavara

This comment was marked as outdated.

@filipnavara
Copy link
Member Author

...and MAUI:
image

@@ -19,9 +19,15 @@
// For each hosting API, we define a function prototype and a function pointer
// The prototype is useful for implicit linking against the dynamic coreclr
// library and the pointer for explicit dynamic loading (dlopen, LoadLibrary)
#ifdef __cplusplus
#define CORECLR_HOSTING_API(function, ...) \
extern "C" int CORECLR_CALLING_CONVENTION function(__VA_ARGS__); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there is EXTERN_C macro to avoid the condition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header is meant for external consumption and it cannot have other dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, maybe this header could use the same preamble as the other shared headers:

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

... code ...

#ifdef __cplusplus
}
#endif // __cplusplus

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no personal preference for either style. They are nearly the same in terms of changed lines.

@EgorBo
Copy link
Member

EgorBo commented Jul 31, 2023

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ghost
Copy link

ghost commented Aug 31, 2023

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@teo-tsirpanis
Copy link
Contributor

@filipnavara do you plan to continue working on this?

@filipnavara
Copy link
Member Author

Yes, it needs a merge/rebase to resolve conflicts.

(I am sick at the moment, so it may have to wait a few days)

@teo-tsirpanis
Copy link
Contributor

OK, reopening, get well soon!

@teo-tsirpanis teo-tsirpanis reopened this Sep 2, 2023
…ld.sh clr+clr.nativeaotlibs+libs+packs -os [iossimulator/maccatalyst/ios] -arch arm64 -cross'
…am.csproj -c Release /p:TargetOS=iossimulator /p:TargetArchitecture=arm64 /p:AppleAppBuilderRuntime=CoreCLR /p:DeployAndRun=true /p:UseMonoRuntime=false /p:RunAOTCompilation=false /p:MonoForceInterpreter=false
@ghost
Copy link

ghost commented Oct 2, 2023

Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 2, 2023
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants