Skip to content

Enable CoreCLR runtime pack for android-arm (armeabi-v7a)#11172

Merged
jonathanpeppers merged 3 commits into
mainfrom
dev/simonrozsival/coreclr-android-arm
Jul 6, 2026
Merged

Enable CoreCLR runtime pack for android-arm (armeabi-v7a)#11172
jonathanpeppers merged 3 commits into
mainfrom
dev/simonrozsival/coreclr-android-arm

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Apr 21, 2026

Copy link
Copy Markdown
Member

Note

This PR was AI/Copilot-generated.

Summary

Enable the CoreCLR runtime flavor for the armeabi-v7a (android-arm) ABI, mirroring the existing android-arm64 and android-x64 wiring. Scope is CoreCLR only — NativeAOT for android-arm is tracked separately in #11423.

Changes

build-tools/scripts/Ndk.projitems

  • Set SupportCoreCLR=True for armeabi-v7a (was False). This single flag drives both the CoreCLR pack production (build-tools/create-packs) and the native runtime RID list.

src/workloads/workloads.csproj

  • Add a PackageDownload for Microsoft.NETCore.App.Runtime.android-arm so the CoreCLR arm32 runtime pack is restored into $(XAPackagesDir) (otherwise RUNTIME_DIR_ARM points at a non-existent directory).

src/native/native-clr.csproj

  • Add armeabi-v7a / arm to AndroidSupportedTargetJitAbis / AndroidSupportedTargetAotAbis so the native CoreCLR host is actually built for arm32; replace the stale "arm64 only" comment.

src/native/CMakeLists.txt

  • Set RUNTIME_DIR_ARM for the CoreCLR local and packaged runtime paths (previously only set for MonoVM).

build-tools/scripts/xa_build_configuration.cmake.in + src/native/cmake-config/cmake-config.csproj

  • Add the CORECLR_APP_RUNTIME_DIR_ARM variable and its @CORECLR_APP_RUNTIME_ANDROID_ARM@ substitution.

src/native/CMakePresets.json.in

  • Add coreclr-default-debug-armeabi-v7a and coreclr-default-release-armeabi-v7a presets.

WorkloadManifest.in.json

  • Add Microsoft.Android.Runtime.CoreCLR.37.android-arm to the workload pack list and pack definitions.

Status

This PR assumes the android-arm CoreCLR runtime pack is available end-to-end. CI may remain red until the dependent runtime/SDK changes flow into this repo:

Keep this PR as draft while those dependencies are missing.

NativeAOT android-arm wiring is tracked separately in #11423.

@simonrozsival simonrozsival added Area: CoreCLR Issues that only occur when using CoreCLR. copilot `copilot-cli` or other AIs were used to author this labels Apr 21, 2026
@simonrozsival
simonrozsival marked this pull request as ready for review April 28, 2026 08:11
Copilot AI review requested due to automatic review settings April 28, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables CoreCLR runtime-pack support metadata for the android-arm (armeabi-v7a) ABI so the Android workload can include a CoreCLR pack for that RID, matching existing arm64/x64 patterns.

Changes:

  • Add Microsoft.Android.Runtime.CoreCLR.36.1.android-arm to the Android workload manifest packs list and pack definitions.
  • Update Ndk.projitems.in to mark armeabi-v7a as SupportCoreCLR=True and add an ApiLevelNonMono value for that ABI.
  • Extend xaprepare placeholder generation to replace the new @NDK_ARMEABI_V7_API_NON_MONO@ placeholder.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json Adds the CoreCLR android-arm runtime pack to the workload manifest.
build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs Adds placeholder substitution for the new arm32 non-mono NDK API placeholder used by generated projitems.
build-tools/scripts/Ndk.projitems.in Marks armeabi-v7a as CoreCLR-supported and introduces an arm32 non-mono API-level property/metadata.

Comment thread build-tools/scripts/Ndk.projitems.in Outdated
@simonrozsival

Copy link
Copy Markdown
Member Author

@copilot address the review and make sure the rest of the repo is ready for armeabi-v7a support

Copilot AI commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

@copilot address the review and make sure the rest of the repo is ready for armeabi-v7a support

Wired up the remaining pieces in 84c9882:

  • src/native/CMakePresets.json.in: added nonmono-common-armeabi-v7a and coreclr-default-{debug,release}-armeabi-v7a presets so --preset coreclr-default-*-armeabi-v7a resolves during _ConfigureRuntimes.
  • build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs: added @NDK_ARMEABI_V7_NONMONO_API_NET@ (CMakePresets) and @NDK_ARMEABI_V7_NONMONO_API@ (XABuildConfig) placeholder substitutions, both mapping to BuildAndroidPlatforms.NdkMinimumNonMonoAPI.
  • build-tools/scripts/XABuildConfig.cs.in: added AndroidTargetArch.Arm to ArchToApiLevelNonMono so MonoAndroidHelper.GetMinimumApiLevel no longer throws for CoreCLR + Arm.
  • src/native/native-clr.csproj: added armeabi-v7a to AndroidSupportedTargetJitAbis so the CoreCLR native runtime is actually built and packaged for that ABI. AOT abis are left as arm64:x86_64.

@simonrozsival

Copy link
Copy Markdown
Member Author

@copilot build failed:

Build Summary: Failed ❌
Build ID: 13956134
Definition: Xamarin.Android-PR
Branch: dev/simonrozsival/coreclr-android-arm
Commit: 84c988208a894ea1c04aa19c1d8502e1c776915a
Reason: batchedCI

All three platform stages (Linux, macOS, Windows) failed with the same root cause: a C++ compilation error in the native CLR host.

Failed Stages
Linux > Build (make jenkins)
macOS > Build (make jenkins)
Windows > Build (Build Solution)
All three stages fail identically during the _BuildAndroidRuntimes target in native-clr.csproj.

Root Cause: C++ Type Mismatch in typemap.cc
File: src/native/clr/host/typemap.cc line 149

error: no matching function for call to 'hash'
Code:

hash_t mvid_hash = xxhash::hash (mvid, 16z);
The mvid parameter is const uint8_t * (const unsigned char *), but xxhash::hash() only accepts const char *.

Candidate not viable (from src/native/common/include/shared/xxhash.hh:61):

candidate function template not viable: no known conversion from
  'const uint8_t *' (aka 'const unsigned char *') to 'const char *'
  for 1st argument
Fix Needed
The call at typemap.cc:149 needs a reinterpret_cast<const char *>(mvid), or xxhash::hash() needs an overload accepting const uint8_t *.

Additional Warning (macOS & Linux only)
src/Mono.Android/metadata(389,3): error BG4304: Invalid XPath specification:
  /api/package[@name='android.graphics.pdf.component']/*/method[...]
This metadata binding error also fires on macOS and Linux builds but is secondary to the native compilation failure that causes the overall build to fail.

Failed Tests
No test results available — the build failed before reaching the test execution phase.

Copilot AI commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

@copilot build failed:

Build Summary: Failed ❌

...

Fixed in 483822f. Root cause: on 32-bit (armeabi-v7a) xamarin::android::xxhash aliases to xxhash32, whose hash overloads only take const char *. On 64-bit it aliases to xxhash64, which has a template<typename T> hash(const T*, size_t) overload — which is why this compiled fine before arm32 was enabled. Added a reinterpret_cast<const char*>(mvid) at the call site, matching the existing pattern in mono/monodroid/embedded-assemblies.cc:787.

The BG4304 metadata error (/api/package[@name='android.graphics.pdf.component']/...) is unrelated to this PR (it's about Android API metadata, not arm32) and per the build summary is secondary to the native compilation failure, so I'm leaving it alone.

@simonrozsival
simonrozsival force-pushed the dev/simonrozsival/coreclr-android-arm branch from 483822f to 35be785 Compare May 20, 2026 14:27
@simonrozsival

Copy link
Copy Markdown
Member Author

@copilot

       "/Users/builder/azdo/_work/5/s/android/Xamarin.Android.sln" (default target) (1:2) ->
       "/Users/builder/azdo/_work/5/s/android/tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj" (default target) (45:6) ->
         /Users/builder/azdo/_work/5/s/android/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/InlineData.cs(7,7): warning CS0105: The using directive for 'System.Globalization' appeared previously in this namespace [/Users/builder/azdo/_work/5/s/android/tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj]


       "/Users/builder/azdo/_work/5/s/android/Xamarin.Android.sln" (default target) (1:2) ->
       "/Users/builder/azdo/_work/5/s/android/src/native/native-clr.csproj" (default target) (20:6) ->
       (_BuildAndroidRuntimes target) -> 
         ld.lld : error : unable to find library -lcoreclr [/Users/builder/azdo/_work/5/s/android/src/native/native-clr.csproj]
         clang++ : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/builder/azdo/_work/5/s/android/src/native/native-clr.csproj]
         /Users/builder/azdo/_work/5/s/android/src/native/native.targets(290,5): error MSB3073: The command "/Users/builder/android-toolchain/sdk/cmake/3.30.3/bin/ninja -v" exited with code 1. [/Users/builder/azdo/_work/5/s/android/src/native/native-clr.csproj]

    266 Warning(s)
    3 Error(s)

Copilot AI commented May 20, 2026

Copy link
Copy Markdown
Contributor

@copilot

...

Addressed in 44570a4. Root cause: the android-arm CoreCLR runtime pack (Microsoft.NETCore.App.Runtime.android-arm) doesn't exist yet — that's blocked on dotnet/runtime#127225 which hasn't shipped. Without it there's no libcoreclr.so for armeabi-v7a for ld.lld to resolve -lcoreclr against. src/native/CMakeLists.txt also has no RUNTIME_DIR_ARM mapping under IS_CLR_RUNTIME for the same reason.

Reverted just the AndroidSupportedTargetJitAbis addition in native-clr.csproj so the native CoreCLR runtime isn't built for arm32 yet. The rest of the wiring (workload manifest, Ndk.projitems, CMake presets, ArchToApiLevelNonMono, the typemap.cc fix) stays in place — once the runtime pack ships, re-enabling is a one-line change.

@simonrozsival
simonrozsival marked this pull request as draft May 20, 2026 16:01
@simonrozsival
simonrozsival force-pushed the dev/simonrozsival/coreclr-android-arm branch from b3881ad to 66397af Compare May 26, 2026 11:37
@simonrozsival
simonrozsival marked this pull request as ready for review May 26, 2026 11:38
@simonrozsival

Copy link
Copy Markdown
Member Author

@copilot fix build failure:

Build FAILED.

       "/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj" (default target) (1) ->
       (CoreCompile target) -> 
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(128,65): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(129,65): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(130,65): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(202,61): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(203,60): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(204,60): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(260,65): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(261,65): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]
         /mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs(262,65): error CS0117: 'BuildAndroidPlatforms' does not contain a definition for 'NdkMinimumNonMonoAPI' [/mnt/vss/_work/1/s/android/build-tools/xaprepare/xaprepare/xaprepare.csproj]

    0 Warning(s)
    9 Error(s)
    ```

Copilot AI commented May 26, 2026

Copy link
Copy Markdown
Contributor

@copilot fix build failure:

Build FAILED.

...

Fixed in 7e27549. Root cause: PR #11331 ([build] Unify Android minimum API level to 24 for all runtimes) merged into main while this branch was open and removed BuildAndroidPlatforms.NdkMinimumNonMonoAPI along with all NonMono plumbing (single API 24 now covers all runtimes). My earlier commits had added NonMono entries back, which became dangling references after the merge.

Cleaned up:

  • Step_GenerateFiles.cs: removed all 9 @NDK_*_NONMONO_API*@ placeholder entries
  • XABuildConfig.cs.in: removed ArchToApiLevelNonMono dictionary (unused — MonoAndroidHelper.GetMinimumApiLevel only uses ArchToApiLevel)
  • Ndk.projitems.in: removed AndroidNdkApiLevelNonMono_* properties and ApiLevelNonMono metadata
  • CMakePresets.json.in: removed nonmono-common-armeabi-v7a; coreclr-default-{debug,release}-armeabi-v7a now inherit from common-armeabi-v7a directly, matching the arm64-v8a/x86_64 pattern

Verified xaprepare builds cleanly locally.

@simonrozsival

Copy link
Copy Markdown
Member Author

@copilot build is failing with an error we've seen before:

       "/mnt/vss/_work/1/s/android/Xamarin.Android.sln" (default target) (1:2) ->
       "/mnt/vss/_work/1/s/android/src/native/native-clr.csproj" (default target) (17:6) ->
       (_BuildAndroidRuntimes target) -> 
         ld.lld : error : unable to find library -lcoreclr [/mnt/vss/_work/1/s/android/src/native/native-clr.csproj]
         clang++ : error : linker command failed with exit code 1 (use -v to see invocation) [/mnt/vss/_work/1/s/android/src/native/native-clr.csproj]
         /mnt/vss/_work/1/s/android/src/native/native.targets(290,5): error MSB3073: The command "/usr/local/lib/android/sdk/cmake/3.30.3/bin/ninja -v" exited with code 1. [/mnt/vss/_work/1/s/android/src/native/native-clr.csproj]

    270 Warning(s)
    3 Error(s)

@simonrozsival

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in 71591e3.

Only conflict was in build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs: PR #11760 moved CMake-input file generation (Get_Cmake_XA_Build_Configuration, Get_Cmake_Presets, GetCmakePresetsCommon) out of xaprepare and into the new src/native/cmake-config/cmake-config.csproj MSBuild project. I took the origin/main side and deleted those now-obsolete methods (they're no longer referenced anywhere). The corresponding Configurables.cs paths were already auto-merged with the same deletions from main.

All of this PR's actual arm32 wiring (workload manifest, Ndk.projitems.in, coreclr-default-*-armeabi-v7a CMake presets, typemap.cc fix) is intact. xaprepare builds clean.

@simonrozsival

simonrozsival commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

@copilot fix these build errors:

         /Users/cloudtest/vss/_work/1/s/android/src/native/mono/monodroid/monodroid-glue.cc(726,88): warning G2C718407: unused parameter 'is_root_domain' [-Wunused-parameter] [/Users/cloudtest/vss/_work/1/s/android/src/native/native-mono.csproj]
         /Users/cloudtest/vss/_work/1/s/android/src/native/mono/monodroid/monodroid-glue.cc(1278,54): warning G2C718407: unused parameter 'force_preload_assemblies' [-Wunused-parameter] [/Users/cloudtest/vss/_work/1/s/android/src/native/native-mono.csproj]


       "/Users/cloudtest/vss/_work/1/s/android/Xamarin.Android.sln" (default target) (1:2) ->
       "/Users/cloudtest/vss/_work/1/s/android/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj" (default target) (10:10) ->
       "/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj" (default target) (25:15) ->
       "/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj" (Build target) (25:16) ->
       (CoreCompile target) -> 
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Android.Runtime/AndroidRuntime.cs(314,40): error CS0426: The type name 'ReflectionJniTypeManager' does not exist in the type 'JniRuntime' [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Android.Runtime/AndroidRuntime.cs(644,41): error CS0426: The type name 'ReflectionJniValueManager' does not exist in the type 'JniRuntime' [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/AndroidReflectionJniValueManager.cs(11,62): error CS0426: The type name 'ReflectionJniValueManager' does not exist in the type 'JniRuntime' [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/ManagedTypeManager.cs(11,39): error CS0426: The type name 'ReflectionJniTypeManager' does not exist in the type 'JniRuntime' [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(24,26): error CS0115: 'JavaMarshalValueManager.Dispose(bool)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(36,23): error CS0115: 'JavaMarshalValueManager.WaitForGCBridgeProcessing()': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(46,23): error CS0115: 'JavaMarshalValueManager.CollectPeers()': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(51,23): error CS0115: 'JavaMarshalValueManager.AddPeer(IJavaPeerable)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(56,33): error CS0115: 'JavaMarshalValueManager.PeekPeer(JniObjectReference)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(61,23): error CS0115: 'JavaMarshalValueManager.RemovePeer(IJavaPeerable)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(66,23): error CS0115: 'JavaMarshalValueManager.FinalizePeer(IJavaPeerable)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(71,23): error CS0115: 'JavaMarshalValueManager.ActivatePeer(JniObjectReference, Type, ConstructorInfo, object?[]?)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(79,44): error CS0115: 'JavaMarshalValueManager.GetSurfacedPeers()': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/JavaMarshalValueManager.cs(213,26): error CS0115: 'JavaMarshalValueManager.TryUnboxPeerObject(IJavaPeerable, out object?)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(29,23): error CS0115: 'SimpleValueManager.WaitForGCBridgeProcessing()': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(33,23): error CS0115: 'SimpleValueManager.CollectPeers()': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(62,23): error CS0115: 'SimpleValueManager.AddPeer(IJavaPeerable)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(124,33): error CS0115: 'SimpleValueManager.PeekPeer(JniObjectReference)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(150,23): error CS0115: 'SimpleValueManager.RemovePeer(IJavaPeerable)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(175,23): error CS0115: 'SimpleValueManager.FinalizePeer(IJavaPeerable)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(210,44): error CS0115: 'SimpleValueManager.GetSurfacedPeers()': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/SimpleValueManager.cs(250,26): error CS0115: 'SimpleValueManager.TryUnboxPeerObject(IJavaPeerable, out object?)': no suitable method found to override [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]
         /Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Microsoft.Android.Runtime/TrimmableTypeMapTypeManager.cs(18,48): error CS0426: The type name 'ReflectionJniTypeManager' does not exist in the type 'JniRuntime' [/Users/cloudtest/vss/_work/1/s/android/src/Mono.Android/Mono.Android.csproj::TargetFramework=net11.0]

    137 Warning(s)
    23 Error(s)

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@copilot fix these build errors:

         /Users/cloudtest/vss/_work/1/s/android/src/native/mono/monodroid/monodroid-glue.cc(726,88): warning G2C718407: unused parameter 'is_root...

Fixed in the latest commit.

Root cause: an earlier commit on this branch (9dca5fa "Apply remaining changes") unintentionally downgraded the external/Java.Interop submodule from 7049364 to d546a08 (an off-main feature-branch tip for PR java-interop#1429) and external/xamarin-android-tools from bcce35f to 7c05b5c. The recent merge from main kept those downgraded pointers. Meanwhile main's Mono.Android code now depends on the newer Java.Interop API (JniRuntime.ReflectionJniTypeManager, ReflectionJniValueManager, and the abstract JavaMarshalValueManager members Dispose(bool)/WaitForGCBridgeProcessing/CollectPeers/AddPeer/PeekPeer/RemovePeer), which only exist in 7049364.

Restored both submodules to main's versions (matching the merge-base, so the downgrade was clearly accidental). Verified all the referenced types/members exist in 7049364.

@simonrozsival
simonrozsival marked this pull request as ready for review July 2, 2026 10:27
Enable the CoreCLR runtime flavor for the armeabi-v7a (android-arm) ABI,
mirroring the existing android-arm64 and android-x64 wiring. Scope is
CoreCLR only; NativeAOT for android-arm remains tracked separately (#11423).

- Ndk.projitems: set SupportCoreCLR=True for armeabi-v7a. This drives both
  the CoreCLR pack production (build-tools/create-packs) and the native
  runtime RID list.
- native-clr.csproj: add armeabi-v7a/arm to the native CoreCLR build ABIs
  and replace the stale "arm64 only" comment.
- CMakeLists.txt: set RUNTIME_DIR_ARM for the CoreCLR local and packaged
  runtime paths (it was only set for MonoVM before).
- xa_build_configuration.cmake.in + cmake-config.csproj: add the
  CORECLR_APP_RUNTIME_DIR_ARM path and its @CORECLR_APP_RUNTIME_ANDROID_ARM@
  substitution.
- CMakePresets.json.in: add coreclr-default-debug/release-armeabi-v7a presets.
- WorkloadManifest.in.json: add Microsoft.Android.Runtime.CoreCLR.37.android-arm
  to the workload pack list and pack definitions.

Requires the microsoft.netcore.app.runtime.android-arm CoreCLR runtime pack
from dotnet/runtime to be available end-to-end; CI may be red until that
dependency flows in.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival
simonrozsival force-pushed the dev/simonrozsival/coreclr-android-arm branch from 660095d to 869ed69 Compare July 2, 2026 11:01
Add the missing Microsoft.NETCore.App.Runtime.android-arm PackageDownload
to workloads.csproj. Without it the CoreCLR arm32 runtime pack is never
restored into $(XAPackagesDir), so RUNTIME_DIR_ARM (set in CMakeLists.txt /
cmake-config.csproj) points at a non-existent directory and the native
CoreCLR arm build cannot find the runtime.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Android PR Review — ⚠️ Needs Changes (pending CI / external dependency)

The arm32 wiring is complete and consistent. I traced each place android-arm64/android-x64 CoreCLR is referenced and confirmed the arm32 sibling was added everywhere:

  • Ndk.projitemsSupportCoreCLR=True for armeabi-v7a (drives pack creation + native RID list via the SupportCoreCLR metadata consumed in Configuration.props and create-packs/Directory.Build.targets).
  • workloads.csprojMicrosoft.NETCore.App.Runtime.android-arm PackageDownload.
  • WorkloadManifest.in.json — pack listed in packs[] and defined in the packs{} map.
  • CMakeLists.txtRUNTIME_DIR_ARM set for both the local and packaged CoreCLR paths (and it is consumed via the ANDROID_ABI MATCHES "^armeabi-v7a" branch → NET_RUNTIME_DIR).
  • xa_build_configuration.cmake.in + cmake-config.csprojCORECLR_APP_RUNTIME_DIR_ARM variable + @CORECLR_APP_RUNTIME_ANDROID_ARM@ substitution.
  • CMakePresets.json.incoreclr-default-{debug,release}-armeabi-v7a presets, matching the existing arm64 inherits pattern exactly.
  • create-packs/Microsoft.Android.Runtime.proj already handles android-arm generically (_ClangArch=arm), so no hardcoded ABI list needed touching.
  • AndroidMinimumDotNetApiLevel is already 24, which satisfies CoreCLR arm32's minimum-API requirement — nothing to bump here.

Main concern (see inline)

Adding armeabi-v7a to AndroidSupportedTargetJitAbis re-enables building the CoreCLR native host for arm32, which must link libcoreclr.so from Microsoft.NETCore.App.Runtime.android-arm. If that pack isn't yet restorable at $(DotNetRuntimePacksVersion), the build fails with ld.lld: error: unable to find library -lcoreclr — the failure that recurred repeatedly in this PR's history. CI build 1491573 is still in progress at review time, so please confirm the arm32 native runtime links green before merging.

Process note

The PR description says to keep this as draft until the runtime/SDK dependencies (dotnet/runtime#127225, dotnet/runtime#126838, dotnet/sdk#54015) flow in, but the PR is not currently marked draft and mergeable_state is blocked. Consider re-marking it draft until CI is green.

Verdict

0 ❌ · 1 ⚠️ · 1 💡 — The code is clean and well-scoped; the inline comment that documents the android-arm runtime-pack dependency right next to the ABI list is a nice touch. Not mergeable until the arm32 CoreCLR native build links successfully in CI.

Generated by Android PR Reviewer for #11172 · 293.9 AIC · ⌖ 36.5 AIC · ⊞ 6.8K
Comment /review to run again

Comment thread src/native/native-clr.csproj
armeabi-v7a (android-arm) requires the microsoft.netcore.app.runtime.android-arm
pack from dotnet/runtime; x86 (android-x86) has no CoreCLR runtime pack. -->
<AndroidSupportedTargetAotAbis>armeabi-v7a:arm64:x86_64</AndroidSupportedTargetAotAbis>
<AndroidSupportedTargetJitAbis>armeabi-v7a:arm64-v8a:x86_64</AndroidSupportedTargetJitAbis>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 ⚠️ MSBuild targets — Adding armeabi-v7a here makes _BuildAndroidRuntimes configure and link the CoreCLR native host for arm32, which resolves -lcoreclr against libcoreclr.so from Microsoft.NETCore.App.Runtime.android-arm (the pack added in workloads.csproj). If that runtime pack isn't flowing yet at $(DotNetRuntimePacksVersion), _BuildAndroidRuntimes fails with ld.lld: error: unable to find library -lcoreclr — the exact failure that recurred several times earlier in this PR. Please confirm the arm32 CoreCLR runtime pack actually restores in the current dependency flow before merging (CI build 1491573 is still running at review time, so the arm32 native link is the thing to watch).

Rule: Verify the external dependency is available before enabling the build path

@simonrozsival

Copy link
Copy Markdown
Member Author

@copilot fix the following build error in C++ code:

       "/Users/cloudtest/vss/_work/1/s/android/Xamarin.Android.sln" (default target) (1:2) ->
       "/Users/cloudtest/vss/_work/1/s/android/src/native/native-clr.csproj" (default target) (18:6) ->
       (_BuildAndroidRuntimes target) -> 
         /Users/cloudtest/vss/_work/1/s/android/src/native/clr/host/typemap.cc(149,21): error GB40677E6: no matching function for call to 'hash' [/Users/cloudtest/vss/_work/1/s/android/src/native/native-clr.csproj]
         /Users/cloudtest/vss/_work/1/s/android/src/native/clr/host/typemap.cc(149,21): error GB40677E6: no matching function for call to 'hash' [/Users/cloudtest/vss/_work/1/s/android/src/native/native-clr.csproj]
         /Users/cloudtest/vss/_work/1/s/android/src/native/native.targets(287,5): error MSB3073: The command "/Users/cloudtest/android-toolchain/sdk/cmake/3.30.3/bin/ninja -v" exited with code 1. [/Users/cloudtest/vss/_work/1/s/android/src/native/native-clr.csproj]

    213 Warning(s)
    3 Error(s)

Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

@copilot fix the following build error in C++ code:

       "/Users/cloudtest/vss/_work/1/s/android/Xamarin.Android.sln" (default target) (1:2) ->

...

Fixed. Reapplied reinterpret_cast<const char*>(mvid) at typemap.cc:149 (matching embedded-assemblies.cc:787). This is the same fix as the earlier commit 483822f — it was dropped during a merge from main. On 32-bit armeabi-v7a, xxhash aliases to xxhash32, whose hash overload only takes const char *, so the raw const uint8_t * needs the cast.

@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Jul 5, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Android PR Reviewer completed successfully!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Code Review — ✅ LGTM

Issues: 0 ❌ · 0 ⚠️ · 1 💡

Enables the CoreCLR runtime flavor for armeabi-v7a (android-arm), mirroring the existing arm64/x64 wiring. I reviewed all 9 changed files and traced the enablement chain end-to-end.

Verified correct & complete

  • Ndk.projitemsSupportCoreCLR=True for armeabi-v7a; this metadata gates CoreCLR pack production in create-packs/Directory.Build.targets (_AndroidRIDs ... Runtime="CoreCLR"). ✓
  • native-clr.csprojarmeabi-v7a added to the JIT/AOT ABI lists. The token matches the global convention in Configuration.props (armeabi-v7a:arm64:x86:x86_64), and ...JitAbisForConditionalChecks is recomputed from the local override before Ndk.projitems reads it. ✓
  • CMakeLists.txtRUNTIME_DIR_ARM now set in both the local and packaged CoreCLR branches; it is consumed at the armeabi-v7a selector (set(NET_RUNTIME_DIR "${RUNTIME_DIR_ARM}")). ✓
  • CMakePresets.json.in — new coreclr-default-{debug,release}-armeabi-v7a presets exactly mirror the arm64 ones and match the name native.targets constructs ($(_PresetPrefix)default-<config>-%(Identity)). No NativeAOT preset, consistent with the PR scope. ✓
  • cmake-config.csproj + xa_build_configuration.cmake.inCORECLR_APP_RUNTIME_ANDROID_ARM substitution follows the arm64/x64 prefix/suffix pattern; the generating target keeps correct Inputs/Outputs. ✓
  • WorkloadManifest.in.json + workloads.csproj — the CoreCLR arm pack is added to all three parallel spots (pack list, pack definition, PackageDownload). No spot missed; the SDK's RuntimePackRuntimeIdentifiers already lists android-arm. ✓
  • typemap.cc — the reinterpret_cast<const char*> is required to compile the DEBUG typemap path on 32-bit; byte-safe, and the RELEASE memcmp path is unaffected (see inline 💡). ✓

Notes (non-blocking)

  • CI is fully green (42/42), including the dotnet-android AzDO checks that build native code for every ABI — strong evidence the arm32 CoreCLR host now compiles and links.
  • The PR description's “keep this PR as draft... CI may remain red until the dependent runtime/SDK changes flow in” now appears stale: CI is green, AndroidMinimumDotNetApiLevel is already 24 (satisfying the arm32 API-24 requirement), and the dependency packs (dotnet/runtime#127225, dotnet/sdk#54015) seem to have landed. Consider updating the description / draft state before merge.

Nicely scoped and consistent with the established multi-ABI patterns. 👍

Generated by Android PR Reviewer for #11172 · 336.4 AIC · ⌖ 27.1 AIC · ⊞ 6.8K
Comment /review to run again

full_type_name.append (typeName);

hash_t mvid_hash = xxhash::hash (mvid, 16z); // we must hope managed land called us with valid data
hash_t mvid_hash = xxhash::hash (reinterpret_cast<const char*>(mvid), 16z); // we must hope managed land called us with valid data

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 💡 Native C++ — The cast is correct and byte-safe, so this is not a bug. It's only needed because on 32-bit ABIs (like the newly-enabled armeabi-v7a) xxhash resolves to xxhash32, whose hash accepts only const char*, whereas the 64-bit xxhash64::hash is a template<typename T> hash(const T*, size_t) that takes const uint8_t* directly. Optional / out-of-scope: giving xxhash32::hash the same generic-pointer overload in xxhash.hh would let this (the sole const uint8_t* caller) drop the per-arch cast and keep the two implementations symmetric.

(Rule: API consistency — align xxhash32 with xxhash64)

@jonathanpeppers
jonathanpeppers merged commit ad8afc0 into main Jul 6, 2026
42 checks passed
@jonathanpeppers
jonathanpeppers deleted the dev/simonrozsival/coreclr-android-arm branch July 6, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CoreCLR Issues that only occur when using CoreCLR. copilot `copilot-cli` or other AIs were used to author this ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants