Skip to content

Commit ad8afc0

Browse files
[build] Enable CoreCLR runtime pack for android-arm (armeabi-v7a) (#11172)
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. ### [workloads] Restore CoreCLR android-arm runtime pack 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>
1 parent 96f5017 commit ad8afc0

9 files changed

Lines changed: 27 additions & 5 deletions

File tree

build-tools/scripts/Ndk.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<ApiLevel>$(AndroidNdkApiLevel_ArmV7a)</ApiLevel>
2424
<AndroidRID>android-arm</AndroidRID>
2525
<SupportMonoVM>True</SupportMonoVM>
26-
<SupportCoreCLR>False</SupportCoreCLR>
26+
<SupportCoreCLR>True</SupportCoreCLR>
2727
<SupportNativeAOT>False</SupportNativeAOT>
2828
</AndroidSupportedTargetJitAbi>
2929

build-tools/scripts/xa_build_configuration.cmake.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ set(NETCORE_APP_RUNTIME_DIR_ARM64 "@NETCORE_APP_RUNTIME_ANDROID_ARM64@")
33
set(NETCORE_APP_RUNTIME_DIR_X86 "@NETCORE_APP_RUNTIME_ANDROID_X86@")
44
set(NETCORE_APP_RUNTIME_DIR_X86_64 "@NETCORE_APP_RUNTIME_ANDROID_X86_64@")
55

6+
set(CORECLR_APP_RUNTIME_DIR_ARM "@CORECLR_APP_RUNTIME_ANDROID_ARM@")
67
set(CORECLR_APP_RUNTIME_DIR_ARM64 "@CORECLR_APP_RUNTIME_ANDROID_ARM64@")
78
set(CORECLR_APP_RUNTIME_DIR_X86_64 "@CORECLR_APP_RUNTIME_ANDROID_X86_64@")

src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"Microsoft.Android.Runtime.Mono.37.android-arm64",
1313
"Microsoft.Android.Runtime.Mono.37.android-x86",
1414
"Microsoft.Android.Runtime.Mono.37.android-x64",
15+
"Microsoft.Android.Runtime.CoreCLR.37.android-arm",
1516
"Microsoft.Android.Runtime.CoreCLR.37.android-arm64",
1617
"Microsoft.Android.Runtime.CoreCLR.37.android-x64",
1718
"Microsoft.Android.Runtime.NativeAOT.37.android-arm64",
@@ -78,6 +79,10 @@
7879
"kind": "framework",
7980
"version": "@WORKLOAD_VERSION@"
8081
},
82+
"Microsoft.Android.Runtime.CoreCLR.37.android-arm": {
83+
"kind": "framework",
84+
"version": "@WORKLOAD_VERSION@"
85+
},
8186
"Microsoft.Android.Runtime.CoreCLR.37.android-arm64": {
8287
"kind": "framework",
8388
"version": "@WORKLOAD_VERSION@"

src/native/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ if(IS_CLR_RUNTIME)
177177
set(LOCAL_CORECLR_CONFIG Release)
178178
endif()
179179

180+
set(RUNTIME_DIR_ARM "${LOCAL_CORECLR_PATH}/${CLR_PACKAGE_NAME_STEM}-arm/${LOCAL_CORECLR_CONFIG}/runtimes/android-arm")
180181
set(RUNTIME_DIR_ARM64 "${LOCAL_CORECLR_PATH}/${CLR_PACKAGE_NAME_STEM}-arm64/${LOCAL_CORECLR_CONFIG}/runtimes/android-arm64")
181182
set(RUNTIME_DIR_X86_64 "${LOCAL_CORECLR_PATH}/${CLR_PACKAGE_NAME_STEM}-x64/${LOCAL_CORECLR_CONFIG}/runtimes/android-x64")
182183
else()
184+
set(RUNTIME_DIR_ARM "${CORECLR_APP_RUNTIME_DIR_ARM}")
183185
set(RUNTIME_DIR_ARM64 "${CORECLR_APP_RUNTIME_DIR_ARM64}")
184186
set(RUNTIME_DIR_X86_64 "${CORECLR_APP_RUNTIME_DIR_X86_64}")
185187
endif()

src/native/CMakePresets.json.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,21 @@
151151
"inherits": ["default-common", "common-debug", "common-armeabi-v7a"]
152152
},
153153

154+
{
155+
"name": "coreclr-default-debug-armeabi-v7a",
156+
"inherits": ["default-common", "common-debug", "common-armeabi-v7a"]
157+
},
158+
154159
{
155160
"name": "default-release-armeabi-v7a",
156161
"inherits": ["default-common", "common-release", "common-armeabi-v7a"]
157162
},
158163

164+
{
165+
"name": "coreclr-default-release-armeabi-v7a",
166+
"inherits": ["default-common", "common-release", "common-armeabi-v7a"]
167+
},
168+
159169
{
160170
"name": "analyzers-debug-armeabi-v7a",
161171
"hidden": true,

src/native/clr/host/typemap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ auto TypeMapper::managed_to_java_debug (const char *typeName, const uint8_t *mvi
146146
dynamic_local_path_string full_type_name;
147147
full_type_name.append (typeName);
148148

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

151151
auto equal = [](TypeMapAssembly const& entry, hash_t key) -> bool { return entry.mvid_hash == key; };
152152
auto less_than = [](TypeMapAssembly const& entry, hash_t key) -> bool { return entry.mvid_hash < key; };

src/native/cmake-config/cmake-config.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<_XaBuildConfigurationReplacement Include="@NETCORE_APP_RUNTIME_ANDROID_ARM64@=$(_NetCoreRuntimePrefix)arm64$(_NetCoreRuntimeSuffix)arm64" />
6262
<_XaBuildConfigurationReplacement Include="@NETCORE_APP_RUNTIME_ANDROID_X86@=$(_NetCoreRuntimePrefix)x86$(_NetCoreRuntimeSuffix)x86" />
6363
<_XaBuildConfigurationReplacement Include="@NETCORE_APP_RUNTIME_ANDROID_X86_64@=$(_NetCoreRuntimePrefix)x64$(_NetCoreRuntimeSuffix)x64" />
64+
<_XaBuildConfigurationReplacement Include="@CORECLR_APP_RUNTIME_ANDROID_ARM@=$(_CoreClrRuntimePrefix)arm$(_CoreClrRuntimeSuffix)arm" />
6465
<_XaBuildConfigurationReplacement Include="@CORECLR_APP_RUNTIME_ANDROID_ARM64@=$(_CoreClrRuntimePrefix)arm64$(_CoreClrRuntimeSuffix)arm64" />
6566
<_XaBuildConfigurationReplacement Include="@CORECLR_APP_RUNTIME_ANDROID_X86_64@=$(_CoreClrRuntimePrefix)x64$(_CoreClrRuntimeSuffix)x64" />
6667

src/native/native-clr.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
<OutputType>Exe</OutputType>
88
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
99

10-
<!-- HACK HACK: until CoreCLR exists for all the targets, work only with arm64 -->
11-
<AndroidSupportedTargetAotAbis>arm64:x86_64</AndroidSupportedTargetAotAbis>
12-
<AndroidSupportedTargetJitAbis>arm64-v8a:x86_64</AndroidSupportedTargetJitAbis>
10+
<!-- CoreCLR is built for every ABI that has a shipping android CoreCLR runtime pack.
11+
armeabi-v7a (android-arm) requires the microsoft.netcore.app.runtime.android-arm
12+
pack from dotnet/runtime; x86 (android-x86) has no CoreCLR runtime pack. -->
13+
<AndroidSupportedTargetAotAbis>armeabi-v7a:arm64:x86_64</AndroidSupportedTargetAotAbis>
14+
<AndroidSupportedTargetJitAbis>armeabi-v7a:arm64-v8a:x86_64</AndroidSupportedTargetJitAbis>
1315
</PropertyGroup>
1416

1517
<Import Project="..\..\Configuration.props" />

src/workloads/workloads.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ inside xaprepare.
3737
<PackageDownload Include="Microsoft.NETCore.App.Runtime.Mono.android-x86" Version="[$(DotNetRuntimePacksVersion)]" />
3838
<PackageDownload Include="Microsoft.NETCore.App.Runtime.Mono.android-x64" Version="[$(DotNetRuntimePacksVersion)]" />
3939
<!-- CoreCLR Android runtime packs -->
40+
<PackageDownload Include="Microsoft.NETCore.App.Runtime.android-arm" Version="[$(DotNetRuntimePacksVersion)]" />
4041
<PackageDownload Include="Microsoft.NETCore.App.Runtime.android-arm64" Version="[$(DotNetRuntimePacksVersion)]" />
4142
<PackageDownload Include="Microsoft.NETCore.App.Runtime.android-x64" Version="[$(DotNetRuntimePacksVersion)]" />
4243

0 commit comments

Comments
 (0)