Skip to content

NativeAOT shared libraries have no SONAME, which breaks versioned symbol lookup on Android #137829

Description

@virzak

A Native AOT library built with NativeLib=Shared on Linux has no DT_SONAME: Microsoft.NETCore.Native.Unix.targets doesn't pass -soname. glibc tolerates that, but bionic matches DT_VERNEED entries against the SONAMEs of loaded libraries, so an executable that uses versioned symbols from such a library can't load on Android:

CANNOT LINK EXECUTABLE "./dotnet-dev-certs": cannot find "libaspnetcoretools.so" from verneed[0] in DT_NEEDED list for ".../dotnet-dev-certs"

This is the aspnetcore tools aggregate from a linux-bionic-arm64 source build of 11.0.0 (Termux), on API 37:

$ readelf -d libaspnetcoretools.so | grep -E 'SONAME|NEEDED'
 (NEEDED)  Shared library: [libdl.so]
 (NEEDED)  Shared library: [libc.so]
 (NEEDED)  Shared library: [libm.so]
$ readelf -V dotnet-dev-certs
  000000: Version: 1  File: libaspnetcoretools.so  Cnt: 1
  0x0020:   Name: V1.0  Flags: none  Version: 3

Passing -Wl,-soname,<output file name> for shared libraries would fix it. Termux works around it by bundling the tools without Native AOT on linux-bionic.

Activity

  1. added
    untriaged
    on Nov 18, 2026
  2. dotnet-policy-service commented on Nov 18, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
    See info in area-owners.md if you want to be subscribed.

  3. MihuBot commented on Nov 18, 2026

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  4. dotnet-policy-service commented on Nov 19, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
    See info in area-owners.md if you want to be subscribed.

  5. removed
    untriaged
    on Nov 25, 2026
  6. added a commit that references this issue on Nov 25, 2026
    ac87276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions