Cake_Git icon indicating copy to clipboard operation
Cake_Git copied to clipboard

Dll not found while trying to get git version of a repo

Open patriksvensson opened this issue 8 years ago • 6 comments

Moved from https://github.com/cake-build/cake/issues/1906 Originally asked by @johnnyasantoss

What You Are Seeing?

I'm having problems to get the git version of a repo using Cake.Git. I think that the problem has something to do with the relative path for the .so file.

What is Expected?

Get the latest tag of the repo.

What version of Cake are you using?

  • 0.22.1

Are you running on a 32 or 64 bit system?

  • 64

What environment are you running on? Windows? Linux? Mac?

I'm using a docker image to build my project (or trying to). Image: johnnyasantoss/dotnet-mono-docker:dotnet2.0-mono5.2-sdk

How Did You Get This To Happen? (Steps to Reproduce)

I tried to run a task and after compiling I got this error message.

Output Log

Gist: https://gist.github.com/anonymous/592a7073ba70b570b1090c92a39545df

patriksvensson avatar Nov 01 '17 19:11 patriksvensson

This is the dockerfile that I'm using https://github.com/johnnyasantoss/JsonFluentMap/blob/testes-unitarios/Dockerfile

johnnyasantoss avatar Nov 01 '17 20:11 johnnyasantoss

I have the same issue, @patriksvensson .

Repro non-working Cake.Git on Linux: https://travis-ci.org/johnkors/cakegit/jobs/351972745#L2503

johnkors avatar Mar 11 '18 13:03 johnkors

A workaround/fix from @devlead on gitter.im: Using a Ubuntu base image instead of say Debian based ( microsoft/sdk-2.1 is Debian based when on Linux containers).

Example of working Ubuntu image: FROM devlead/bitbucket-pipelines-dotnet.

johnkors avatar Mar 19 '18 09:03 johnkors

Seems to be related to libgit2/libgit2sharp#1533

devlead avatar Mar 19 '18 10:03 devlead

I'm getting this issue as well. I've tried the posted workaround, and it had no effect :( here's the error I'm getting (note this is gitversion throwing the error):

========================================
GetVersion
========================================

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux/x86_64/libgit2-baa87df.so
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux/x86_64/libgit2-baa87df.so
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0
An error occurred when executing task 'GetVersion'.
Error: One or more errors occurred.
        GitVersion: Process returned an error (exit code 255).

davidvedvick avatar Mar 23 '18 21:03 davidvedvick

The solution given here helped me out.

https://github.com/cake-contrib/Cake_Git/issues/68#issuecomment-399462309

johnkors avatar Aug 03 '18 12:08 johnkors