question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to load shared library 'git2-7ce88e6' or one of its dependencies.

See original GitHub issue

Hi there,

So I’ve encountered with a quite strange problem when I tried to run my program on ubuntu. As you can see in the log below the app crashes each time when trying to invoke any method from libgit, and it is quite strange cause this project works on Windows10 perfectly.

The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
   at LibGit2Sharp.Core.NativeMethods.git_clone(git_repository*& repo, String origin_url, FilePath workdir_path, GitCloneOptions& opts)
   at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 275
   at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options) in C:\projects\libgit2sharp\LibGit2Sharp\Repository.cs:line 779
   at Stt.GitSync.Infrastructure.Managers.RepositoriesManager.CloneIfNotExists(ConfigurationData data) in /home/grimm/Documents/SE/C#/SttGitSync/Stt.GitSync/Infrastructure/Managers/RepositoriesManager.cs:line 96

Unable to load shared library 'git2-7ce88e6' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-7ce88e6: cannot open shared object file: No such file or directory
   at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
   at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary() in C:\projects\libgit2sharp\LibGit2Sharp\Core\NativeMethods.cs:line 78
   at LibGit2Sharp.Core.NativeMethods..cctor() in C:\projects\libgit2sharp\LibGit2Sharp\Core\NativeMethods.cs:line 56

Reproduction steps

Try to use any LibGit2 method and you get this error

Expected behavior

Repository is cloned

Actual behavior

Exception is raised

Version of LibGit2Sharp (release number or SHA1)

<PackageReference Include="LibGit2Sharp" Version="0.26.1" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.289" />

Operating system(s) tested; .NET runtime tested

ubuntu 19.04 netcoreapp2.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:29 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
nZeuscommented, Jan 2, 2020

I tried mcr.microsoft.com/dotnet/core/sdk:3.1-bionic and it works! 🎉

5reactions
AleksandrSorcommented, Nov 30, 2019

Apparently, lib2git cant find correct native binaries so I helped it with this trick I had all needed binaries in /app/runtimes/ so i added env variable into my Dockerfile like this

FROM base AS final

ENV LD_LIBRARY_PATH=/app/runtimes/debian.9-x64/native/

work for dotnet core 3.0 (aspnet:3.0-buster-slim)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to load shared library while running the program
I am facing strange issue while loading shared library in a cpp program. When the make file is executed then it works fine...
Read more >
Unable to load shared library 'libdl.so' or one of its ...
I'm trying to compile a project and the compilation fails due to a missing library. ... I've been searching for known solutions in...
Read more >
Error: Unable to load shared library 'hostfxr' or one of its ...
It generated the following error message "Unable to load shared library 'hostfxr' or one of its dependencies. In order to help diagnose loading...
Read more >
Dotnet driver v2.14.1 error: "Unable to load shared library ' ...
I get Unable to load shared library 'libdl' or one of its dependencies exception when initializing the client in this specific case:.
Read more >
Unable to load shared library 'gurobi81'
7. Get the following error: System.DllNotFoundException: 'Unable to load shared library 'gurobi90' or one of its dependencies. In order to help diagnose loading ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found