libgit2 / libgit2sharp.nativebinaries

MIT License
28 stars 62 forks source link

are the binaries supporting CentOS and archlinux ? #48

Closed NikkyAI closed 7 years ago

NikkyAI commented 7 years ago

I am trying to use https://www.nuget.org/packages/LibGit2Sharp.Portable/ and i am not sure why it keeps failing to load the binaries on archlinux (and arch based distros like manjaro ) amd CentOS 7 on dotnet core dotnet/coreclr#11005 NikkyAI/alpacka#13

bording commented 7 years ago

@NikkyAI The problem you're running into is that the linux .so file included in the NativeBinaries package is built on Ubuntu 12.04, so due to how linux distros vary, it's the only one that it's going to work on for sure. Other versions of Ubuntu are also likely to work, but other distros are going to depend on how much they are different compared to Ubuntu.

CentOS specifically is a problem because the version of OpenSSL they ship has a custom soname that doesn't match the standard version if you compile OpenSSL directly from source.

LibGit2Sharp doesn't yet officially support .NET Core. The LibGit2Sharp.Portable library that @aarnott released is sort of a placeholder until the full support is merged in: https://github.com/libgit2/libgit2sharp/pull/1318. It's getting close, but it's not quite ready yet.

One of the additional things I want to do as part of getting .NET Core officially ready to go is to make some additional tweaks to how the NativeBinaries package is built. One of those tweaks is to try and include more linux distributions in the package.

One of the reasons this hasn't been done previously is that with mono, there's not currently a good way to automatically pick the correct library, so even if we had shipped more than one, there'd be no way to select it without manual effort. I see in https://github.com/NikkyAI/alpacka/issues/13#issuecomment-294379521 that you've noticed the LibGit2Sharp.dll.config file. This is only used by mono, and it's how the .so vs. .dylib is chosen. Unfortunately, it doesn't have a way to get more specific than "linux or osx". There's no way to use it to chose between multiple distro-specific .so files.

With .NET Core's ability to select the correct library based on RIDs, this makes it worth spending the time to improve this. Ideally, I'd like to see the NativeBinaries package ship with a native library for every distribution that .NET Core is supported on, but I don't know exactly when that goal will be achieved.

NikkyAI commented 7 years ago

would it be possible to somehow include the .so file for at least centos in our package (since archlinux has no RID and is not officially supported) and a time estimate on offical support would be nice.. or at least knowing if we talk about days, weeks or months

archlinux xupport would be a dream as well since most of our users and devs have that or some flavor based on arch

bording commented 7 years ago

@NikkyAI If you want to work around the issue for now until something more official is ready, you could clone this repo and build the native library file for CentOS yourself, and then you'd have to add it your package in the correct runtimes subfolder structure. Given the more specific RID, I believe that would result in your CentOS-specific library being chosen.

You'd also probably need to explicitly exclude the runtime assets from the NativeBinaries package via your package references to make sure the one in there isn't also discovered: https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files

I think that should have a decent chance of getting something functional while you're waiting.

NikkyAI commented 7 years ago

i experimented and replacing the .so file in the nuget folder with the libgit2.so found on the system works for devs and for users i made a script that builds and replaces the .so file in the release/publish folder

the info about being compiled on ubuntu was really what was missing