Skip to content

GitVersion.CommandLine does not work on Linux #1097

Closed
@mclang

Description

@mclang

I have F# project created with Forge where I use Paket and FAKE to manage things. My problem is same as described in GitVersion.CommandLine does not work on OS X.

Using FAKE's build.sh produces following error:

Checking Paket version (downloading latest stable)...
Paket.exe 3.30.0 is up to date.
Paket version 3.30.0
0 seconds - ready.
mono  "<path removed>/packages/GitVersion.CommandLine/tools/GitVersion.exe" 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: GitVersion.exe failed with exit code 255
  at Fake.GitVersionHelper+GitVersion@62.Invoke (System.String message) [0x00001] in <58343e1dccf1c534a74503831d3e3458>:0 
  at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[TResult].Finalize () [0x00012] in <5584aad2904cf4daa7450383d2aa8455>:0 
  at Microsoft.FSharp.Core.PrintfImpl+Final1@224[TState,TResidue,TResult,A].Invoke (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] env, A a) [0x00038] in <5584aad2904cf4daa7450383d2aa8455>:0 
  at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5584aad2904cf4daa7450383d2aa8455>:0 
  at Fake.GitVersionHelper.GitVersion (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] setParams) [0x00045] in <58343e1dccf1c534a74503831d3e3458>:0 
  at <StartupCode$FSI_0005>.$FSI_0005_Build$fsx.main@ () [0x00008] in <629f008c31ba4d198101e488c9c57117>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00053] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
  at Fake.FSIHelper+runScriptCached@313.Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x0008d] in <58343e1dccf1c534a74503831d3e3458>:0 
System.Exception: GitVersion.exe failed with exit code 255
  at Fake.GitVersionHelper+GitVersion@62.Invoke (System.String message) [0x00001] in <58343e1dccf1c534a74503831d3e3458>:0 
  at Microsoft.FSharp.Core.PrintfImpl+StringPrintfEnv`1[TResult].Finalize () [0x00012] in <5584aad2904cf4daa7450383d2aa8455>:0 
  at Microsoft.FSharp.Core.PrintfImpl+Final1@224[TState,TResidue,TResult,A].Invoke (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] env, A a) [0x00038] in <5584aad2904cf4daa7450383d2aa8455>:0 
  at Microsoft.FSharp.Core.OptimizedClosures+Invoke@3253[T2,TResult,T1].Invoke (T2 u) [0x00001] in <5584aad2904cf4daa7450383d2aa8455>:0 
  at Fake.GitVersionHelper.GitVersion (Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] setParams) [0x00045] in <58343e1dccf1c534a74503831d3e3458>:0 
  at <StartupCode$FSI_0005>.$FSI_0005_Build$fsx.main@ () [0x00008] in <629f008c31ba4d198101e488c9c57117>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 
Stopped due to error

Running GitVersion.CommandLine manually produces this:

mono packages/GitVersion.CommandLine/tools/GitVersion.exe

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux/x86_64/libgit2-381caf5.so
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <3ab13c1aa72c4390898e735d2abfa167>:0 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <3ab13c1aa72c4390898e735d2abfa167>:0 
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <3ab13c1aa72c4390898e735d2abfa167>:0

The library that the complaint is about is present in the file system under lib directory beside GitVersion.exe and LibGit2Sharp.dll

$ ll packages/GitVersion.CommandLine/tools/
drwxr-xr-x 5 mclang 4.0K 2016-11-24 12:19 lib/
-rw-r--r-- 1 mclang 381K 2016-09-03 02:06 GitVersion.exe
-rw-r--r-- 1 mclang  44K 2016-09-03 02:06 GitVersion.pdb
-rw-r--r-- 1 mclang 413K 2016-09-03 02:06 LibGit2Sharp.dll
-rw-r--r-- 1 mclang  252 2016-09-03 02:06 LibGit2Sharp.dll.config
-rw-r--r-- 1 mclang 1.2M 2016-09-03 02:06 LibGit2Sharp.pdb

$ ll packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-381caf5.so
-rw-r--r-- 1 mclang 1.1M 2016-09-03 02:06 packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-381caf5.so

I am using Arch Linux with Mono version 4.6.1, F# 4.1, Paket 3.30.0, FAKE 4.45.3, GitVersion.CommandLine 3.6.4.

Creating GitVersion.exe.config file does not help... Any idea why the library is not found and how to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions