-
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
Linux: support broader range of distros/architectures by trying to load packed native libraries. #1714
Conversation
…ad packed native libraries. LibGit2Sharp includes a number of native libraries that are built on different OSes. These native libraries have a dependency on OpenSSL and the system c-library. On x64, in case the Linux flavor is not known, a fallback is performed to the 'linux-x64' native library. This library is built with a dependency on OpenSSL 1.0. OpenSSL 1.0 is deprecated by OpenSSL 1.1, so on more recent version of Linux, the 'linux-x64' library fails to load. On arm64, native libraries are currently included for debian.* (OpenSSL 1.1) and ubuntu.18.04 (OpenSSL 1.0). Loading on other distros will fail. In both cases LibGit2Sharp is probably including a library that works, but the default resolution logic is not able to find it. By using the 'NativeLibrary' class (.NET Core 3.0) we can extend the resolution logic, and try to load the other native libraries that are packed with LibGit2Sharp.
Jesus, LibGit2Sharp needs to 🔥 the dependency on OpenSSL. |
The dependency comes from libgit2. |
Yes, I'm aware. But libgit2 can use myriad options for HTTPS, including a custom one. |
That's a nice feature, and it will solve the main reason for load failures. |
CI on Windows has a failed test:
|
Independent of getting rid of the OpenSSL dependency, this change has value. For example, when new releases of Alpine are made (which the rid graph doesn't yet map to |
Sure, sorry, I was idly speculating / complaining, I wasn't suggesting that any other changes should preclude merging it. But @bording understands this stuff much better than I, so I'll leave it to him. |
@bording can you take a look? We've hit this a few times when bringing .NET Core to new versions of Fedora (which causes the mapping to |
@tmds I've been rather busy recently and haven't had much spare time to devote to LibGit2Sharp recently, but I'll try and take a look at this soon. I'm curious where you've hit problems with this, though. Where in .NET Core are you running into a LibGit2Sharp dependency? It was my understanding that that the only place was in the Source Link packages, but those have since removed LibGit2Sharp entirely. |
dotnet/source-build#1083 describes the issues with source-build. The issue applies to any app using libgit2sharp that is meant to work on a broad range of linux-x64/linux-arm64 distros. |
So this is an interesting change, and I had been following the The NativeBinaries package has always had to walk the tightrope of ensuring as many distros as possible are covered, without also completely exploding the size of the package by building a library for each possible RID. That means that I've had to pay a lot of attention to the RID graph to figure out how a given distro gets mapped in there. And, as you've observed, it's a moving target, so we're always having to play catch up. I think what this really demonstrates is that .NET Core's RID mechanism needs improvement, but I know there are already open issues about that. As a first step, I think it makes sense to make this change. Eventually, I'd be inclined to add a |
This has been published on NuGet.org as 0.27.0-preview-0020. |
|
I tinkered with my
I agree. This is the main one: NuGet/Home#5862. |
LibGit2Sharp 0.27.0-preview-0020 improves support for a number of architectures and linux distributions: libgit2/libgit2sharp#1714 This makes it possible to use arcade (via source-build) on RHEL on arm64.
LibGit2Sharp 0.27.0-preview-0020 improves support for a number of architectures and linux distributions: libgit2/libgit2sharp#1714 This makes it possible to use arcade (via source-build) on RHEL on arm64.
Issue still persists with 'git2-7ce88e6' dll not found. |
LibGit2Sharp includes a number of native libraries that are built on different OSes.
These native libraries have a dependency on OpenSSL and the system c-library.
On x64, in case the Linux flavor is not known, a fallback is performed to the 'linux-x64' native library.
This library is built with a dependency on OpenSSL 1.0.
OpenSSL 1.0 is deprecated by OpenSSL 1.1, so on more recent version of Linux, the 'linux-x64' library fails to load.
On arm64, native libraries are currently included for debian.* (OpenSSL 1.1) and ubuntu.18.04 (OpenSSL 1.0).
Loading on other distros will fail.
In both cases LibGit2Sharp is probably including a library that works, but the default resolution logic
is not able to find it.
By using the 'NativeLibrary' class (.NET Core 3.0) we can extend the resolution logic, and try to load
the other native libraries that are packed with LibGit2Sharp.