Skip to content

How to build on linux armv7l

Crypto Compress edited this page Jan 21, 2018 · 1 revision

How to build LibGit2Sharp on linux-arm(v7l)

Step-by-step instructions on how i got LibGit2Sharp working on my arm phone.

  • running debian stretch
  • should be same for raspi
got some exceptions and started digging
System.DllNotFoundException: Unable to load DLL 'git2-15e1193': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary()
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-15e1193': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.git_repository_open(git_repository*& repository, FilePath path)
   at LibGit2Sharp.Core.Proxy.git_repository_open(String path)
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'git2-15e1193': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.LoadNativeLibrary()
   at LibGit2Sharp.Core.NativeMethods..cctor()
   --- End of inner exception stack trace ---
   at LibGit2Sharp.Core.NativeMethods.git_repository_open(git_repository*& repository, FilePath path)
   at LibGit2Sharp.Core.Proxy.git_repository_open(String path)
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)
installed dependencies
# sudo apt-get install git-core build-essential cmake

(not shure what exactly is required)

cloned repo
# git clone --recursive https://github.com/libgit2/libgit2sharp.nativebinaries
[...]
Submodule path 'libgit2': checked out '15e119375018fba121cf58e02a9f17fe22df0df8'
fatal: No url found for submodule path 'libgit2/tests/resources/rebase-submodule/my-submodule' in .gitmodules
Failed to recurse into submodule path 'libgit2'

(ignored "my-submodule" error)

started build
# cd libgit2sharp.nativebinaries/
# ./build.libgit2.sh
[...]
[100%] Linking C shared library libgit2-15e1193.so
[100%] Built target git2
 # find ./nuget.package/libgit2/linux-arm*
./nuget.package/libgit2/linux-armv7l
./nuget.package/libgit2/linux-armv7l/native
./nuget.package/libgit2/linux-armv7l/native/libgit2-15e1193.so

Build successful!

copied .so to publish dir
# cp ./nuget.package/libgit2/linux-armv7l/native/libgit2-15e1193.so /home/android/<MyCoolApp>/netcoreapp2.0/linux-arm/publish/
cd /home/android/<MyCoolApp>/netcoreapp2.0/linux-arm/publish/
DOTNET_CLI_TELEMETRY_OPTOUT=1 dotnet <MyCoolApp>.dll --env=testing -vvv
got new and unrelated error
LibGit2Sharp.RepositoryNotFoundException: Path '/<my>/<git>/<path>' doesn't point at a valid Git repository or workdir.
   at LibGit2Sharp.Core.Proxy.git_repository_open(String path)

LibGit2Sharp working! That was easy! :)

and some useless environment info
# uname -a
Linux localhost 3.4.113-lineage-g0cb72b9-dirty #1 SMP PREEMPT Mon Nov 20 10:38:08 CET 2017 armv7l GNU/Linux
# dotnet --info

Microsoft .NET Core Shared Framework Host

  Version  : 2.1.0-preview1-26029-02
  Build    : 4db634d19fe0d3683ff7e594e9c51a552211b4a5