Skip to content

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

Open
simonrozsival wants to merge 4 commits intomainfrom
dev/simonrozsival/coreclr-android-arm
Open

Enable CoreCLR runtime pack for android-arm (armeabi-v7a)#11172
simonrozsival wants to merge 4 commits intomainfrom
dev/simonrozsival/coreclr-android-arm

Conversation

@simonrozsival
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, following the same pattern as android-arm64 and android-x64.

Changes

build-tools/scripts/Ndk.projitems.in

  • Set SupportCoreCLR=True for armeabi-v7a (was False)
  • Add ApiLevelNonMono metadata (referencing the new AndroidNdkApiLevelNonMono_Arm property)
  • Add AndroidNdkApiLevelNonMono_Arm property with @NDK_ARMEABI_V7_API_NON_MONO@ placeholder

build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs

  • Add @NDK_ARMEABI_V7_API_NON_MONO@NdkMinimumNonMonoAPI placeholder replacement

WorkloadManifest.in.json

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

Dependencies

Enable the CoreCLR runtime flavor for the armeabi-v7a ABI, following the
same pattern as android-arm64 and android-x64.

Changes:
- Set SupportCoreCLR=True for armeabi-v7a in Ndk.projitems.in
- Add ApiLevelNonMono metadata and corresponding property/placeholder
- Add Microsoft.Android.Runtime.CoreCLR.36.1.android-arm to workload manifest

Depends on dotnet/runtime#127225 and dotnet/runtime#126838 (API level 24).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.

<AndroidRID>android-arm</AndroidRID>
<SupportMonoVM>True</SupportMonoVM>
<SupportCoreCLR>False</SupportCoreCLR>
<SupportCoreCLR>True</SupportCoreCLR>
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

Setting True for armeabi-v7a makes the build/packs treat android-arm CoreCLR as supported, but the rest of the repo is not wired up for it yet: src/native/native-clr.csproj still restricts AndroidSupportedTargetJitAbis to arm64-v8a:x86_64, src/native/CMakePresets.json.in has no coreclr-* presets for armeabi-v7a, and the CoreCLR/NonMono min-API mapping in XABuildConfig.ArchToApiLevelNonMono has no AndroidTargetArch.Arm entry (MonoAndroidHelper.GetMinimumApiLevel will throw for CoreCLR+Arm). Either keep SupportCoreCLR=false for armeabi-v7a for now, or add the missing native presets/build support and the ArchToApiLevelNonMono entry so CoreCLR android-arm builds are actually possible.

Suggested change
<SupportCoreCLR>True</SupportCoreCLR>
<SupportCoreCLR>False</SupportCoreCLR>

Copilot uses AI. Check for mistakes.
Comment on lines 10 to 17
"Microsoft.Android.Runtime.36.1.android",
"Microsoft.Android.Runtime.Mono.36.1.android-arm",
"Microsoft.Android.Runtime.Mono.36.1.android-arm64",
"Microsoft.Android.Runtime.Mono.36.1.android-x86",
"Microsoft.Android.Runtime.Mono.36.1.android-x64",
"Microsoft.Android.Runtime.CoreCLR.36.1.android-arm",
"Microsoft.Android.Runtime.CoreCLR.36.1.android-arm64",
"Microsoft.Android.Runtime.CoreCLR.36.1.android-x64",
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

The workload manifest now declares Microsoft.Android.Runtime.CoreCLR.36.1.android-arm as part of the android workload. With the current repo state, CoreCLR native runtime builds/packs are only produced for arm64/x86_64 (see src/native/native-clr.csproj and CMake presets), so this entry is likely to make workload install/pack creation fail or produce an incomplete runtime pack for android-arm. Please ensure the CoreCLR android-arm runtime pack is actually generated and published by the build (native runtime build + runtime pack creation) before listing it here, or gate the manifest entry until those pieces are in place.

Copilot uses AI. Check for mistakes.
@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

Agent-Logs-Url: https://github.com/dotnet/android/sessions/57a8b6d4-93df-4f84-9b77-3a58a6e2158b

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

Copilot AI commented Apr 28, 2026

@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.

Agent-Logs-Url: https://github.com/dotnet/android/sessions/0e9f046e-d5f6-471f-97d4-3f8da467c15b

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

Copilot AI commented Apr 28, 2026

@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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants