libgit2 / libgit2sharp.nativebinaries

MIT License
29 stars 63 forks source link

"How to build your own native binaries" instructions are not working as it is #78

Closed pmunshi007 closed 3 years ago

pmunshi007 commented 6 years ago

I am trying to build binaries in my CentOS docker container after cloning the repository as I am facing multiple errors as below and not able to build my container.

/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL '/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/lib/linux/x86_64/libgit2-6311e88.so':

I realize this library is not compatible with CentOS from https://github.com/libgit2/libgit2sharp/issues/1391 issue and to solve the issue I need to build .so file from the source code which I am trying to do and currently I am following the instruction provided in the README.md file and it is throwing errors. for some dependencies I am solving the dependencies one after another but document should help to resolve the issues with pre-requisite section for software needs to be installed and environmental variables needs to be set. While running the build script I am receiving below errors currently.

CMake Error: The source directory "/tmp/libgit2sharp.nativebinaries/libgit2" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache
/tmp/libgit2sharp.nativebinaries
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
RID not defined. Falling back to 'unix-x64'.
cp: cannot stat 'libgit2/build/libgit2-8e0b172.so': No such file or directory
ethomson commented 6 years ago

Do you have a CMakeLists.txt there? Did you git submodule init && git submodule update to pull in libgit2?

On Nov 1, 2018, at 19:47, pmunshi007 notifications@github.com wrote:

I am trying to build binaries in my CentOS docker container after cloning the repository as I am facing multiple errors as below and not able to build my container.

/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: Unable to load DLL '/root/.nuget/packages/nerdbank.gitversioning/2.2.13/build/lib/linux/x86_64/libgit2-6311e88.so':

I realize this library is not compatible with CentOS from libgit2/libgit2sharp#1391 issue and to solve the issue I need to build .so file from the source code which I am trying to do and currently I am following the instruction provided in the README.md file and it is throwing errors. for some dependencies I am solving the dependencies one after another but document should help to resolve the issues with pre-requisite section for software needs to be installed and environmental variables needs to be set. While running the build script I am receiving below errors currently.

CMake Error: The source directory "/tmp/libgit2sharp.nativebinaries/libgit2" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. Error: could not load cache /tmp/libgit2sharp.nativebinaries tput: No value for $TERM and no -T specified tput: No value for $TERM and no -T specified RID not defined. Falling back to 'unix-x64'. cp: cannot stat 'libgit2/build/libgit2-8e0b172.so': No such file or directory — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

bording commented 6 years ago

@pmunshi007 That issue does not reflect the current state of things. If you use the 0.26.0 preview versions of LibGit2Sharp, it should work with CentOS.

pmunshi007 commented 6 years ago

@ethomson I did not do git submodule init and update. I though I am cloning the repo so I may not need to do those steps. Those steps need to perform in case of repo already exist in the system. Let me add these 2 steps. The above error is removed but I am still getting multiple errors with CMake file @bording I am using Nerdbank.GitVersioning version 2.2.13 and while building image on CentOS with this package reference I am receiving this LibGit2Sharp error. I will still try to specify this version of LibGit2Sharp but I think the Nerdbank.GitVersioning version 2.2.13 is using this library internally I cannot change the version. Correct me if I am going in wrong directions. This issue is going on since last 2 days and I am not able to find any suitable solution yet.

bording commented 6 years ago

@pmunshi007 If you're not using LibGit2Sharp directly, then building your own copy of libgit2 using this repo isn't going to help you.

You'll need to file an issue with Nerdbank.GitVersioning to get the version of LibGit2Sharp used by it updated.

pmunshi007 commented 6 years ago

@bording Thank you so much for your prompt reply. I really appreciate it. You saved my efforts processing and trying for solution in wrong direction.

ekwus commented 6 years ago

Hey

I have an issue on the microsoft/dotnet:2.1 docker container where LibGit2Sharp is using libssl.so.1.0.0 but it is missing due to it being deprecated and unsafe. Once I add the file from an old .deb file the error goes away.

In the past I tried to soft link it to the installed version but the only thing that works is adding the actual file.

My use case is via GitVersioning and I'm now testing with their fix228 pulled in which uses 0.26.0-preview-0054.

Cheers

Dave

bording commented 6 years ago

@ekwus See my comment on your other post about this: https://github.com/AArnott/Nerdbank.GitVersioning/issues/228#issuecomment-437398241