Skip to content

Consider using android-native-tools for native AOT #10697

Closed

Description

@sbomer

Android framework version

net11.0-android (Preview)

Affected platform version

.NET 11

Description

We should consider using tools from https://github.com/dotnet/android-native-tools when linking a native AOT executable, instead of requiring the android NDK. This would simplify the acquisition experience.

Open questions:

  • Are the workload pack tools sufficient to replace dependencies from the NDK?
  • Should runtime tests use the tools from the workload pack?

@MichalStrehovsky pointed to some prior art in

<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\crtbegin_so.o" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\crtend_so.o" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libc++_static.a" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libc++abi.a" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libclang_rt.builtins-$(_ClangArch)-android.a" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libunwind.a" />
</ItemGroup>
<ItemGroup Condition=" '$(AndroidRuntime)' == 'Mono' ">
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libmono-android.debug.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libmono-android.release.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libxamarin-debug-app-helper.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libxamarin-native-tracing.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libunwind_xamarin-debug.a" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libunwind_xamarin-release.a" />
</ItemGroup>
<ItemGroup Condition=" '$(AndroidRuntime)' != 'NativeAOT' ">
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libc.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libdl.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\liblog.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libm.so" />
<NativeRuntimeAsset Include="$(NativeRuntimeOutputRootDir)$(_RuntimeRedistDirName)\$(AndroidRID)\libz.so" />
<NativeRuntimeAsset Condition=" Exists('$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libarchive-dso-stub.so') " Include="$(NativeRuntimeOutputRootDir)$(_RuntimeFlavorDirName)\$(AndroidRID)\libarchive-dso-stub.so" />

Next step is to prototype this - I plan on taking a stab at it. @jonathanpeppers @grendello

Implementation plan:

  • Override ILC's built-in linker invocation so we control the arguments
  • Invoke lld directly instead of using clang wrapper
  • Add ci configuration that can run tests without a provisioned NDK, plus smoke test
  • Add initial implementation to use workload bits under opt-in flag (should pass smoke test)
  • Expand ci coverage to cover all existing nativeaot tests
  • Flip the default

Activity

  1. added
    needs-triage
    on Jan 15, 2026
  2. self-assigned this
    on Jan 15, 2026
  3. added
    enhancement
    and removed
    needs-triage
    on Jan 15, 2026
  4. added this to the .NET 11 milestone on Jan 15, 2026
  5. grendello commented on Jan 16, 2026

    @grendello
    Contributor

    Since we package not only the tools but also shared libraries from the NDK (libc, libm, libdl, liblog, libz), to make "verified" linking process possible, I think it should be possible to implement this.

  6. locked and limited conversation to collaborators on Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

  • Status
    No status

Relationships

None yet

Development

No branches or pull requests

Issue actions