Failing to load shared library 'git2-a418d9d' on android/arm64v8a #158
Open
Description
I am running a .NET 8 Maui Application on Android 13 (API Level 33) with architecture arm64v8a
In my app i am utilising the nuget package "LibGit2Sharp 0.30.0" that has a transitive reference to "LibGit2Sharp.NativeBinaries 2.0.322".
Upon calling Repository.Init("path/to/my/repo")
my app crashes:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
---> System.DllNotFoundException: git2-a418d9d
at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
at LibGit2Sharp.Core.NativeMethods..cctor()
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.Proxy.git_repository_init_ext(FilePath workdirPath, FilePath gitdirPath, Boolean isBare)
at LibGit2Sharp.Repository.Init(String path, Boolean isBare)
at LibGit2Sharp.Repository.Init(String path)
logcat output when executing the Repository.Init
method:
[monodroid-assembly] Shared library 'git2-a418d9d' not loaded, p/invoke 'git_repository_init_ext' may fail
[monodroid-assembly] Shared library 'kernel32' not loaded, p/invoke 'LoadLibrary' may fail
[monodroid-assembly] Shared library 'libdl' not loaded, p/invoke 'dlopen' may fail
[monodroid-assembly] Shared library 'git2-a418d9d' not loaded, p/invoke 'git_libgit2_init' may fail
[monodroid-assembly] Shared library 'git2-a418d9d' not loaded, p/invoke 'git_openssl_set_locking' may fail
[monodroid-assembly] Shared library 'git2-a418d9d' not loaded, p/invoke 'git_libgit2_init' may fail
I checked the contents of my *.apk file and could correctly locate libgit2-a418d9d.so
under lib/arm64-v8a
also the provided lib in the nuget seems to be of correct format/architecture:
$file libgit2-a418d9d.so
libgit2-a418d9d.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=91bb85cb63fc4326cd958916c059432d51053d31, not stripped
dependencies of the lib:
$ objdump -p libgit2-a418d9d.so
libgit2-a418d9d.so: file format elf64-little
Program Header:
LOAD off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**16
filesz 0x000000000015f708 memsz 0x000000000015f708 flags r-x
LOAD off 0x0000000000160660 vaddr 0x0000000000170660 paddr 0x0000000000170660 align 2**16
filesz 0x0000000000006680 memsz 0x0000000000006db8 flags rw-
DYNAMIC off 0x0000000000161820 vaddr 0x0000000000171820 paddr 0x0000000000171820 align 2**3
filesz 0x0000000000000200 memsz 0x0000000000000200 flags rw-
NOTE off 0x00000000000001c8 vaddr 0x00000000000001c8 paddr 0x00000000000001c8 align 2**2
filesz 0x0000000000000024 memsz 0x0000000000000024 flags r--
EH_FRAME off 0x000000000012ee28 vaddr 0x000000000012ee28 paddr 0x000000000012ee28 align 2**2
filesz 0x00000000000058c4 memsz 0x00000000000058c4 flags r--
STACK off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
RELRO off 0x0000000000160660 vaddr 0x0000000000170660 paddr 0x0000000000170660 align 2**0
filesz 0x00000000000019a0 memsz 0x00000000000019a0 flags r--
Dynamic Section:
NEEDED libdl.so.2
NEEDED librt.so.1
NEEDED libpthread.so.0
NEEDED libc.so.6
SONAME libgit2-a418d9d.so.1.7
INIT 0x00000000000161e0
FINI 0x000000000011636c
INIT_ARRAY 0x0000000000170660
INIT_ARRAYSZ 0x0000000000000008
FINI_ARRAY 0x0000000000170668
FINI_ARRAYSZ 0x0000000000000008
GNU_HASH 0x00000000000001f0
STRTAB 0x0000000000008140
SYMTAB 0x0000000000001cd8
STRSZ 0x000000000000572c
SYMENT 0x0000000000000018
PLTGOT 0x0000000000171fe8
PLTRELSZ 0x0000000000003c48
PLTREL 0x0000000000000007
JMPREL 0x0000000000012598
RELA 0x000000000000e140
RELASZ 0x0000000000004458
RELAENT 0x0000000000000018
VERNEED 0x000000000000e0d0
VERNEEDNUM 0x0000000000000003
VERSYM 0x000000000000d86c
RELACOUNT 0x00000000000002c6
Version References:
required from libdl.so.2:
0x06969197 0x00 04 GLIBC_2.17
required from libpthread.so.0:
0x06969197 0x00 03 GLIBC_2.17
required from libc.so.6:
0x06969185 0x00 05 GLIBC_2.25
0x06969197 0x00 02 GLIBC_2.17
Am i missing something? How could I get more info about why the shared library 'git2-a418d9d' can not be loaded?
Any help appreciated :-)
Metadata
Assignees
Labels
No labels