Skip to content

[One .NET] improve native library ABI detection at build time #5432

@jonathanpeppers

Description

@jonathanpeppers

Context: #5386

To determine the Android ABI of native libraries, we currently:

  • Look for %(Abi) metadata
  • Look for a directory named: armeabi-v7a, arm64-v8a, x86, x86_64

This will not work in .NET 6, if the native library is coming from a NuGet package with a path such as:

packages\sqlitepclraw.lib.e_sqlite3.android\1.1.11\runtimes\android-arm64\native\libe_sqlite3.so

Instead of doing more inference with directory names, we should actually look at the contents of the .so file and:

  • Give a warning if it is not an Android library and ignore it.
  • Determine the ABI. If none found, emit a warning and ignore it.

We should still use the %(Abi) metadata if specified, for backwards compatibility.

We could try using the ElfSharp library to do this. We would need to make sure the code path is fast, or we have some mechanism for making incremental builds fast.

Useful links:

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions