-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to load shared library 'git2-7ce88e6' or one of its dependencies. #1703
Comments
Hi, the same issue on my Mac. On windows everything works fine. Rolling back to 0.26.0 works. Best regards |
Hmm, I've tried to create the empty project which just clones the public repository. and this error occurs again and again, and the version of libgit does not matter. I've also attached my .csproj, probably I've done something wrong.
|
I have the same issue too when running in Azure Functions |
Apparently, lib2git cant find correct native binaries so I helped it with this trick 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) |
As of now libgit2sharp provides the native libraries for the following linux distributions, In such case using ubuntu 19.04 is not going to work. Try using Ubuntu 18.04 and see if it works. Otherwise try switching to any of the above mentioned linux distributions. |
|
Encountered the same issue when running in Docker. Changed my runtime from:
to
solves the problem. |
I tried |
For me, it worked with Thanks |
Looks like the problem is that the binary What worked for me was adding an MSBuild |
this is becoming a problem. Is there any plan to support newer ubuntu versions than 18.x? |
It's not really sustainable to be constantly chasing support for newer platforms for a number of reasons. There needs to be a native binary compiled to match the versions of the dependencies on the distro. There are plans to sidestep the entire problem by removing as many dependencies as possible from the native binary, enabling a single linux binary to work with most/all distros. The biggest piece of work remaining to enable this is #1618. |
Regarding newer Ubuntu:
The reason is that since Ubuntu Eoan OpenSSL 1.0 was completely removed from shipping within distro. Shipping a libgit2 linked against OpenSSL 1.1 does the work. |
Raspbian buster (Debian 10 based) has the same I'm using Nuke to build and it's failing on GitVersion which is using LibGit2Shap. To be fair, building on a Raspberry Pi is not practical. Much better to cross compile for ARM. It was just curiosity really. Though it does mean I can't use GitVersion from the command line on the pi either. GitTools/GitVersion#2260 |
@tjmoore I use Cake and GitVersion, which is a similar setup. You should be able to get it to work by pre-installing See gitfool/Cake.Dungeon@0655e23 for my workaround for the GitLab shared Linux runners which are now based on Debian 10. |
Official .NET 5.0 Docker images are using Debian 10 now, so it'd be nice to see that added to the list of supported platforms. The LD_LIBRARY_PATH hack does work though... |
Getting errors with LibGit2Sharp and this suggested it doesn't support beyond 18.04: libgit2/libgit2sharp#1703 (comment)
Getting errors with LibGit2Sharp and this suggested it doesn't support beyond 18.04: libgit2/libgit2sharp#1703 (comment)
cmon fix this |
@bigpod98 This should be fixed with the latest preview release. |
@bording after i vented my frustration i looked at other issues a bit closly and i found that i should use preview release and it worksy was just about to remove my frustrated comment |
Since the latest preview release should have fixed this, I'm going to go ahead and close it. |
The current stable version of LibGit2Sharp (0.26.2) does not work on Linux. The latest preview version runs without any issues. See: libgit2/libgit2sharp#1703 (comment)
The current stable version of LibGit2Sharp (0.26.2) does not work on Linux. The latest preview version runs without any issues. See: libgit2/libgit2sharp#1703 (comment)
I'm on the latest preview (0.27.0-preview-0007) and this is not working on aspnet:5.0-buster-slim, which according to: https://hub.docker.com/_/microsoft-dotnet-aspnet is a debian 10 image. Could someone advise on the preview version/dotnet5 image combo I should be using please? |
@csurfleet The latest preview version is 0.27.0-preview-0119, so give that a try. |
@bording I'm experiencing the same problem with 0.27.0-preview-0119 on the Bitbucket CI/CD infrastructure. Unfortunately, it's not appearing consistently (I guess it depends what actual build agent is chosen to build the solution). The error I'm seeing sporadically is:
As this is a closed issue, I've opened #1914 for this. |
Where can I find this list? |
Way back in 2019 when I posted this answer, I was using LibGit2Sharp.NativeBinaries v2.0.289 and libgit2sharp was providing the native libraries for the distributions I have mentioned. You can look at the list here under runtimes directory in the following link https://nuget.info/packages/LibGit2Sharp.NativeBinaries/2.0.289 The latest version of libgit2sharp v0.27.0-preview-0119 has a dependency on LibGit2Sharp.NativeBinaries v2.0.315-alpha.0.1, the native libraries supported can be found here https://nuget.info/packages/LibGit2Sharp.NativeBinaries/2.0.315-alpha.0.1 If you are using libgit2sharp v0.26.2, then it has a dependency on LibGit2Sharp.NativeBinaries v2.0.306, the native libraries supported can be found here https://nuget.info/packages/LibGit2Sharp.NativeBinaries/2.0.306 |
The current stable version of LibGit2Sharp (0.26.2) does not work on Linux. The latest preview version runs without any issues. See: libgit2/libgit2sharp#1703 (comment)
<!-- For the checkboxes below you must check each one to indicate that you either did the relevant task, or considered it and decided there was nothing that needed doing --> Added code to do a similar thing we do with our other e2e tests, where the test is responsible for resetting the test data that it expects in the test environment. This makes it easy to stand up new environments, and prevent accidentally breaking test environments by unintentional manual changes in the BBS server(s). It also makes it easy to add new data shapes to our test environments, as we just add them in one place (in the code) rather than having to manually touch each of our BBS test servers (and we will have several of them before we're done with the BBS work). Right now these additions will check if the BBS project exists, and if so iterate and delete all repos in the project, then delete the project. Then create the project(s) and repo(s) from scratch. It uses libgit2sharp to initialize the repos. This dependency only exists in our e2e test code, not in the CLI that we ship to customers. libgit2sharp comes with native binaries for various linux distro's, but only includes ubuntu 18.04 but our build servers use ubuntu 20.04 (or maybe 22.04). The workaround is to use the LD_LIBRARY_PATH env var when building our integration test project to force it to link to the ubuntu 18.04 binary (libgit2/libgit2sharp#1703 (comment)) This has pretty much everything we need to support testing against BBS 5.14 also (#570 ) except for some reason the initialize repo code fails consistently when run against BBS 5.14. Once somebody figures out why that fails, you just need to add an extra [InlineData] attribute to the test case and it will run for both. Closes #573 - [x] Did you write/update appropriate tests - [x] Release notes updated (if appropriate) - [x] Appropriate logging output - [x] Issue linked - [x] Docs updated (or issue created) <!-- For docs we should review the docs at: https://docs.github.com/en/early-access/github/migrating-with-github-enterprise-importer and the README.md in this repo If a doc update is required based on the changes in this PR, it is sufficient to create an issue and link to it here. The doc update can be made later/separately. The process to update the docs can be found here: https://github.com/github/docs-early-access#opening-prs The markdown files are here: https://github.com/github/docs-early-access/tree/main/content/github/migrating-with-github-enterprise-importer -->
Hitting the same problem trying to run LibGit2Sharp in AWS lambda EDIT: Managed to hack around the issue based on advice from these two comments:
The You need to replace the so after the project is published, but obviously before you zip it and upload it to AWS. Again based on the above comment I used the following msbuild code for .NET 6 (edit your <Project>
...
<Target Name="GitLib2SharpFix" AfterTargets="Publish">
<!--See: https://github.com/libgit2/libgit2sharp/issues/1703#issuecomment-1364750879 -->
<Exec Command="copy "$(ProjectDir)bin\Release\net6.0\runtimes\rhel-x64\native\libgit2-106a5f2.so" "bin\Release\net6.0\publish\libgit2-106a5f2.so""/>
</Target>
</Project> |
Upgrading to the preview fixed the "Unable to load shared library 'git2-106a5f2' or one of its dependencies" As I was on alpine, it gave me another error that it is unable to load ssl/open ssl libraries, which I suspect is because alpine is lightweight. I switched to focal version and that fixed the ssl problem too. |
I found a work around for this, when using the dotnet:sdk6.0-alpine image. I used strace to determine it was loading the library from FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine
RUN apk add git libgit2
COPY my_app/bin/Release/net6/publish/ /app/
RUN cp /usr/lib/libgit2.so.1.5 /app/runtimes/alpine.3.9-x64/native/libgit2-106a5f2.so I would expect this sort of approach to work for any base image that can install a system libgit2, since the system libgit2 will be compatible with the system, while the native-managed invocations won't be tightly coupled, meaning the precise version of libgit2 isn't relevant to LibGit2Sharp, as long as all the entry points it calls are present. |
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.
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)
Operating system(s) tested; .NET runtime tested
ubuntu 19.04
netcoreapp2.2
The text was updated successfully, but these errors were encountered: