-
Notifications
You must be signed in to change notification settings - Fork 893
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
System.DllNotFoundException: lib/linux/x86_64/libgit2-1196807.so on Ubuntu Linux #1585
Comments
As a workaround for me worked this trick with installing libgit2-24 globally and setup its target path in |
I seems I solved the issue by installing That comment helps - #1472 (comment) |
@evil-shrike curl is a requirement, so it sounds like you've fixed the problem! |
@bording yeah, but may be it makes sense to put the required curl module besides libgit2-1196807.so? Or at least put some warning in Readme? |
Attempting to bundle other libraries instead of linking against the system versions is not something we want to do, especially for something like OpenSSL. Adding something to the README that lists all of the required native dependencies is a good idea! |
We are not going to ship OpenSSL (which we would have to do, transitively), and you don’t want us to. If there are security holes in it, you want a single source of OpenSSL that you can patch. You want to know that you fixed all of them when you do. You don’t want some version that we installed still being vulnerable. |
I agree about openssl, but I think you should statically link libcurl. It is a problematic dependency that various greatly between Ubuntu versions and packages on Ubuntu. I've had more trouble with libcurl than any other library, trying to find the "sweet spot" of configuration for my OS and docker images. |
Also, the latest .NET Core 2.1.1 depends upon libcurl4.
As it stands, I don't think LibGit2Sharp.NativeBinaries currently work on the latest .NET Core. Try to use it in the latest |
I rebuilt libgit2 using the latest .NET Core docker images. diff --git a/Dockerfile.linux-x64 b/Dockerfile.linux-x64
index 3a5c69c..745a352 100644
--- a/Dockerfile.linux-x64
+++ b/Dockerfile.linux-x64
@@ -1,4 +1,4 @@
-FROM ubuntu:14.04
+FROM microsoft/dotnet:2.1.1-runtime-bionic
WORKDIR /nativebinaries
COPY . /nativebinaries/ This works. It is a lot more setup with my docker images, considering I know how to manually build libgit2 and put it in the right place, but it works now. |
I am building libgit2 as a part of my docker build now. This ensures the resulting binary is valid for the platform. FROM microsoft/dotnet:2.1.1-runtime-bionic
RUN apt-get update
RUN apt -y install cmake libcurl4-openssl-dev libssl-dev pkg-config git
RUN apt-get clean
RUN git clone https://github.com/libgit2/libgit2.git /libgit2 && \
cd /libgit2 && \
git checkout b0d9952c318a3d1b8917e06ad46b9110c0c28831
RUN cd /libgit2 && \
cmake -DCMAKE_BUILD_TYPE:STRING=Release \
-DBUILD_CLAR:BOOL=OFF \
-DUSE_SSH=OFF \
-DENABLE_TRACE=ON \
-DLIBGIT2_FILENAME=git2-b0d9952 \
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \
. && \
cmake --build .
FROM microsoft/dotnet:2.1.1-runtime-bionic
COPY --from=0 /libgit2/libgit2-b0d9952.so /yourapp/runtimes/linux-x64/native
|
We are currently using the same native library for all versions of Ubuntu. If 18.04 has changed the version of curl it ships, then we'll have to build a specific version of the library for it and ship it in the native binaries package. |
This was reproduced on Debian 9 as well, so not just an Ubuntu issue. |
The latest 0.26.0 preview release includes both an Ubuntu 18.04 and Debian 9 binary, so it should work. |
The following seems to work just fine on Ubuntu 18.10. I've tested with GitVersion modified to use these versions.
|
@magne Do you have |
Yes, libssl1.0.0 (and libssl1.1) is installed. |
My understanding is that |
As you can see when I try to remove libssl1.0.0, it's dependents include the .Net Core runtimes and the openssh client. These I have installed. But it also includes the snap daemon, and I belive that was present after the initial OS installation.
I've also tried to spin up the |
Thanks for the additional information! That doesn't seem to line up with my initial testing, so it looks like I've got some more investigation to do. However, if we can reasonably assume that |
I got hit with this same problem of libgit2sharp not being able to load the native library (In my case, I had all dependencies needed for the library, but running on Arch Linux instead of Ubuntu. Which is probably not officially supported). I was able to solve this by adding a new I appended the following to the configuration file (without removing anything) <dllmap os="linux" dll="git2-6311e88" target="libgit2.so" /> Hopefully this helps someone else coming across this issue with the same problem. |
On debian 9 with v0.26.0 and libgit2sharp.nativebinaries.2.0.278 I needed to change from
|
@maulwuff thanks, that helped me work around the issue (on WSL2 Ubuntu 20.04 .NETCore 3.1.401) |
I have difficulties with LibGit2Sharp while running Cake (with Cake.Git addin) build on Linux Ubuntu 16.04 in Docker - cake-contrib/Cake_Git#68
But I managed to isolate issue with LibGit2Sharp only.
Reproduction steps
Mono looks up for native module in subfolder bacause of config
the file
lib/linux/x86_64/libgit2-1196807.so
does exist. also tried to copy it besides my .exe module.Expected behavior
no error
Actual behavior
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux/x86_64/libgit2-1196807.so
Version of LibGit2Sharp (release number or SHA1)
libgit2-1196807.so
Operating system(s) tested; .NET runtime tested
The text was updated successfully, but these errors were encountered: