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

Enable iOS/tvOS simulators on arm64 #51536

Closed
wants to merge 12 commits into from

Conversation

steveisok
Copy link
Member

No description provided.

@dotnet-issue-labeler
Copy link

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.

@steveisok
Copy link
Member Author

@akoeplinger Interesting error on arm64 simulator:

https://helixre107v0xdeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-51536-merge-29f7a57527f24b9d93/HelloiOS/console.f22e094b.log?sv=2019-07-07&se=2021-05-10T01%3A13%3A26Z&sr=c&sp=rl&sig=y793uEF2pkU6jpQgqCMvUmvrDpUIYbpG97c2z%2Fd7Q8A%3D

error MT0117: Can't launch a 32-bit app on a simulator that only supports 64-bit apps (iPhone X (iOS 14.4) - created by XHarness).
[18:13:57] dbug: 18:13:57.8468270
[18:13:57] dbug: 18:13:57.8641960   at Xamarin.Launcher.SimController.Ensure64bitApp (Xamarin.Hosting.Bindings.SimDevice device, Xamarin.Hosting.AppBundle app_bundle) [0x00060] in <fd345040cf8646afbcdd85e8867162a4>:0
[18:13:57] dbug: 18:13:57.8642500   at Xamarin.Launcher.SimController.SelectAppArchitecture (Xamarin.Hosting.Bindings.SimDevice device, Xamarin.Hosting.AppBundle app_bundle) [0x000bb] in <fd345040cf8646afbcdd85e8867162a4>:0
[18:13:57] dbug: 18:13:57.8642640   at Xamarin.Launcher.SimController.InstallAsync (Xamarin.Hosting.SimulatorInstallConfig config) [0x0001c] in <fd345040cf8646afbcdd85e8867162a4>:0

@filipnavara
Copy link
Member

filipnavara commented Apr 20, 2021

@steveisok That's not too surprising given the code in Ensure64bitApp:

	IEnumerable<MachOFile> files = MachO.Read(app_bundle.ExecutablePath);
	foreach (MachOFile file in files)
	{
		if (file.Architecture == MachO.Architectures.x86_64)
		{
			return;
		}
	}

Unfortunately it's the closed source part of Xamarin so I cannot submit a PR. The check should likely be extended to allow ARM64 and ARM64e.

@akoeplinger
Copy link
Member

@mandel-macaque @premun would you mind fixing the mlaunch code to support arm64 simulators?

@premun
Copy link
Member

premun commented Apr 20, 2021

@akoeplinger I opened a PR with a following fix:
image

Do you have an ARM64 machine at hand? I can send you the built mlaunch with this fix and you can test the run (using --mlaunch arg on XHarness)?

@akoeplinger
Copy link
Member

Yep I do have an arm64 mac, but I'm about to hop into a meeting. Can you attach the new mlaunch here?

@premun
Copy link
Member

premun commented Apr 20, 2021

mlaunch.tar.gz
then

xharness apple test ... --mlaunch=mlaunch.app/Contents/MacOS/mlaunch

@akoeplinger
Copy link
Member

@premun I tested and it works :)

@@ -384,6 +384,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\libraries\System.Buffers\tests\System.Buffers.Tests.csproj"
Exclude="@ProjectExclusions" />
<!--
Copy link
Member

Choose a reason for hiding this comment

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

This is just temporarily commented out, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, once the sanity check passes, I'll enable the rest.

@runfoapp runfoapp bot mentioned this pull request May 5, 2021
@ghost ghost closed this Jun 4, 2021
@ghost
Copy link

ghost commented Jun 4, 2021

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

@lambdageek
Copy link
Member

We should give this another go using "JustInterp" (--aot=interp) mode like in #53197. The cross-compilers should be in better shape because most of the no-exec stuff was not catalyst-specific.

@steveisok steveisok reopened this Jun 4, 2021
@steveisok
Copy link
Member Author

@lambdageek After a few adjustments on my local build, it's now failing on

appdomain.c:197, condition `is_ok (error)' not met, function:create_domain_objects, Attempting to JIT compile method 'void System.OutOfMemoryException:.ctor (string)' while running in aot-only mode.

@lambdageek
Copy link
Member

@steveisok the src/tasks/AppleAppBuilder/Templates/runtime.m template needs to be adjusted to set the AOT mode to MONO_AOT_MODE_INTERP.

We have all that stuff conditioned on TARGET_OS_MACCATALYST, but probably we should have some more direct way to pass down the appropriate AOT mode (instead of trying to guess from the target and from the force aot / force interpreter values) from the Xcode.cs down to the CMakeLists.txt template and down to runtime.m

#elif (!TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST) || FORCE_AOT
register_dllmap ();
// register modules
register_aot_modules ();
#if (FORCE_INTERPRETER && TARGET_OS_MACCATALYST)
os_log_info (OS_LOG_DEFAULT, "AOT INTERP Enabled");
mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP);
#else
mono_jit_set_aot_mode (MONO_AOT_MODE_FULL);
#endif

@ghost ghost closed this Jul 23, 2021
@ghost
Copy link

ghost commented Jul 23, 2021

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

@ghost ghost locked as resolved and limited conversation to collaborators Aug 22, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants