Skip to content

GitVersion.CommandLine does not work on Linux #1097

Closed

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 [email protected] (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 [email protected] (Microsoft.FSharp.Core.Unit unitVar0) [0x0008d] in <58343e1dccf1c534a74503831d3e3458>:0 
System.Exception: GitVersion.exe failed with exit code 255
  at [email protected] (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?

Activity

  1. mclang commented on Nov 24, 2016

    @mclang
    Author

    Noticing that there is file called LibGit2Sharp.dll.config, I tried to change it to include full path into the required library. Doesn't help, but the exception message does change:

    $ mono packages/GitVersion.CommandLine/tools/GitVersion.exe 
    
    Unhandled Exception:
    System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: /<path removed>/packages/GitVersion.CommandLine/tools/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
    
  2. asbjornu commented on Nov 26, 2016

    @asbjornu
    Member

    @mclang: Can you please try installing libcurl as per #1101 and see if that helps?

  3. mclang commented on Nov 28, 2016

    @mclang
    Author

    I have newest available curl, which is 7.51.0-1, installed but I don't know if it has the required libcurl3 files. I also tried installing libcurl-compat package but that didn't help.

    This time tough I got longer error message that I missed in my first post:

    $ mono packages/GitVersion.CommandLine/tools/GitVersion.exe 
    INFO [11/28/16 10:49:41:64] Working directory: <my project dir>
    INFO [11/28/16 10:49:41:66] IsDynamicGitRepository: False
    ERROR [11/28/16 10:49:41:69] An unexpected error occurred:
    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.Proxy.git_buf_free (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
      at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
      at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
      at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x0000d] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
      at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
      at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <57cedcc684654481ace045b6d7bcc156>:0 
      at GitVersion.GitPreparer.GetProjectRootDirectory () [0x00048] in <57cedcc684654481ace045b6d7bcc156>:0 
      at GitVersion.ConfigurationProvider.Verify (GitVersion.GitPreparer gitPreparer, GitVersion.Helpers.IFileSystem fileSystem) [0x00006] in <57cedcc684654481ace045b6d7bcc156>:0 
      at GitVersion.Program.VerifyConfiguration (GitVersion.Arguments arguments, GitVersion.Helpers.IFileSystem fileSystem) [0x00023] in <57cedcc684654481ace045b6d7bcc156>:0 
      at GitVersion.Program.VerifyArgumentsAndRun () [0x000ba] in <57cedcc684654481ace045b6d7bcc156>:0 
    INFO [11/28/16 10:49:41:69] 
    INFO [11/28/16 10:49:41:69] Attempting to show the current git graph (please include in issue): 
    INFO [11/28/16 10:49:41:69] Showing max of 100 commits
    ERROR [11/28/16 10:49:41:95] Couldn't dump the git graph due to the following error: System.InvalidOperationException: Cannot process request because the process (5399) has exited.
      at System.Diagnostics.Process.GetProcessHandle (System.Int32 access, System.Boolean throwIfExited) [0x0005a] in <6c7c03f48a9747c8a644da4f63a34480>:0 
      at System.Diagnostics.Process.GetProcessHandle (System.Int32 access) [0x00000] in <6c7c03f48a9747c8a644da4f63a34480>:0 
      at System.Diagnostics.Process.set_PriorityClass (System.Diagnostics.ProcessPriorityClass value) [0x00032] in <6c7c03f48a9747c8a644da4f63a34480>:0 
      at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:set_PriorityClass (System.Diagnostics.ProcessPriorityClass)
      at GitTools.ProcessHelper.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x00020] in <57cedcc684654481ace045b6d7bcc156>:0 
      at GitTools.ProcessHelper.Run (System.Action`1[T] output, System.Action`1[T] errorOutput, System.IO.TextReader input, System.String exe, System.String args, System.String workingDirectory, System.Collections.Generic.KeyValuePair`2[System.String,System.String][] environmentalVariables) [0x0012c] in <57cedcc684654481ace045b6d7bcc156>:0 
      at GitTools.LibGitExtensions.DumpGraph (System.String workingDirectory, System.Action`1[T] writer, System.Nullable`1[T] maxCommits) [0x00035] in <57cedcc684654481ace045b6d7bcc156>:0 
      at GitVersion.Program.VerifyArgumentsAndRun () [0x001b7] in <57cedcc684654481ace045b6d7bcc156>:0 
    
    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
    
  4. mclang commented on Nov 28, 2016

    @mclang
    Author

    Maybe this helps:

    $ ldd packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-baa87df.so 
    packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-baa87df.so: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-baa87df.so)
    packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-baa87df.so: /usr/lib/libssl.so.1.0.0: no version information available (required by packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-baa87df.so)
    packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-baa87df.so: /usr/lib/libcrypto.so.1.0.0: no version information available (required by packages/GitVersion.CommandLine/tools/lib/linux/x86_64/libgit2-baa87df.so)
    	linux-vdso.so.1 (0x00007ffdeaf66000)
    	libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007fd34146d000)
    	libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007fd3411fc000)
    	libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007fd340d84000)
    	librt.so.1 => /usr/lib/librt.so.1 (0x00007fd340b7c000)
    	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fd34095f000)
    	libc.so.6 => /usr/lib/libc.so.6 (0x00007fd3405bf000)
    	libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007fd340392000)
    	libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007fd340144000)
    	libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007fd33fe60000)
    	libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007fd33fc2f000)
    	libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007fd33fa2b000)
    	libz.so.1 => /usr/lib/libz.so.1 (0x00007fd33f813000)
    	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd33f60f000)
    	/usr/lib64/ld-linux-x86-64.so.2 (0x0000558090c58000)
    	libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007fd33f402000)
    	libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007fd33f1fe000)
    	libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007fd33efe7000)
    

    For me at least it seems that I need to install libcurl3 somehow... I can't find it from Arch repositories or from AUR :(

  5. mclang commented on Nov 28, 2016

    @mclang
    Author

    With both 64bit abd 32bit curl and libcurl-compat installed I have /usr/lib/libcurl.so.3 though:

    ll /usr/lib/libcurl*
    -rwxr-xr-x 1 root 470K 2016-11-02 15:25 /usr/lib/libcurl-compat.so.4.4.0*
    lrwxrwxrwx 1 root   16 2016-11-02 13:12 /usr/lib/libcurl.so -> libcurl.so.4.4.0*
    lrwxrwxrwx 1 root   23 2016-11-02 15:25 /usr/lib/libcurl.so.3 -> libcurl-compat.so.4.4.0*
    lrwxrwxrwx 1 root   16 2016-11-02 13:12 /usr/lib/libcurl.so.4 -> libcurl.so.4.4.0*
    lrwxrwxrwx 1 root   23 2016-11-02 15:25 /usr/lib/libcurl.so.4.0.0 -> libcurl-compat.so.4.4.0*
    lrwxrwxrwx 1 root   23 2016-11-02 15:25 /usr/lib/libcurl.so.4.1.0 -> libcurl-compat.so.4.4.0*
    lrwxrwxrwx 1 root   23 2016-11-02 15:25 /usr/lib/libcurl.so.4.2.0 -> libcurl-compat.so.4.4.0*
    lrwxrwxrwx 1 root   23 2016-11-02 15:25 /usr/lib/libcurl.so.4.3.0 -> libcurl-compat.so.4.4.0*
    -rwxr-xr-x 1 root 470K 2016-11-02 13:12 /usr/lib/libcurl.so.4.4.0*
    
  6. mclang commented on Nov 28, 2016

    @mclang
    Author

    I found this LibGit2Sharp issue: Unable to load native DLL if path contains %2F

    May not be related because my project path does not contain spaces, but linking it here so that maybe somebody gets an idea.

  7. asbjornu commented on Nov 28, 2016

    @asbjornu
    Member

    @mclang: %2f is /, not space. It is quite common to use / as a separator in Git Flow, for feature/*, hotfix/*, support/*, and similar branches. What is the name of the branch you're having this problem with?

  8. mclang commented on Nov 28, 2016

    @mclang
    Author

    Oh, okay... Should have checked that character code before posting :|

    My project path is like: /home/mclang/Projects/<project-name>. I'm using master branch so no forward slashes there.

    I searched for that version 'CURL_OPENSSL_3' not found message and found out that in many cases the program or library in question was compiled against an older libcurl. Can this be the case here also?

  9. mclang commented on Dec 7, 2016

    @mclang
    Author

    Hello

    Any idea what I should try next?

  10. asbjornu commented on Dec 7, 2016

    @asbjornu
    Member

    As the problem seems to be within LibGit2Sharp, it is going to be hard finding someone with knowledge of the problem in the GitVersion repository. Perhaps you can try to file an issue with LibGit2Sharp and see how you fare there? Sorry that I can't be of more assistance. 😕

  11. mclang commented on Dec 8, 2016

    @mclang
    Author

    I'l do that in the issue linked above.

  12. asbjornu commented on Dec 8, 2016

    @asbjornu
    Member

    @mclang: Okay. Fingers crossed!

  13. sandorfr commented on Feb 14, 2017

    @sandorfr

    @asbjornu @mclang have you found a solution to your issue?

  14. asbjornu commented on Feb 17, 2017

    @asbjornu
    Member

    @sandorfr: It seems like libgit2/libgit2sharp#1409 should remedy the problem, so we might investigate whether that has also been released and if so update LibGit2Sharp and see whether that helps. Are you or @mclang up for the task?

  15. mclang commented on Mar 30, 2017

    @mclang
    Author

    Well I tried, sort of.

    Probably what I did is stupid, but anyway... I have this in my paket.dependencies file:

    nuget GitVersion.CommandLine
    nuget LibGit2Sharp >= 0.24.0-pre20170124092542
    

    After paket install I tried as before and got:

    $ 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-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
    

    Then I copied the new prelease LibGit2Sharp files over the ones that current GitVersion provides:

    $ cp -v packages/LibGit2Sharp/lib/net40/LibGit2Sharp.* packages/GitVersion.CommandLine/tools/
    'packages/LibGit2Sharp/lib/net40/LibGit2Sharp.dll' -> 'packages/GitVersion.CommandLine/tools/LibGit2Sharp.dll'
    'packages/LibGit2Sharp/lib/net40/LibGit2Sharp.pdb' -> 'packages/GitVersion.CommandLine/tools/LibGit2Sharp.pdb'
    'packages/LibGit2Sharp/lib/net40/LibGit2Sharp.xml' -> 'packages/GitVersion.CommandLine/tools/LibGit2Sharp.xml'
    

    Well... something happened but still no joy with using GitVersion:

    mono packages/GitVersion.CommandLine/tools/GitVersion.exe 
    
    Unhandled Exception:
    System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-1196807
      at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
      at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <d72f745aed3e475995df19d10a3f4219>:0 
      at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <d72f745aed3e475995df19d10a3f4219>:0 
       --- End of inner exception stack trace ---
      at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <d72f745aed3e475995df19d10a3f4219>:0 
    [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-1196807
      at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
      at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <d72f745aed3e475995df19d10a3f4219>:0 
      at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <d72f745aed3e475995df19d10a3f4219>:0 
       --- End of inner exception stack trace ---
      at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <d72f745aed3e475995df19d10a3f4219>:0
    

    Digging more, I found that git2-1196807 is located under LibGit2Sharp.NativeBinaries and gives:

    $ ldd packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so 
    ldd: warning: you do not have execution permission for `packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so'
    packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so)
    packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so: /usr/lib/libssl.so.1.0.0: no version information available (required by packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so)
    packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so: /usr/lib/libcrypto.so.1.0.0: no version information available (required by packages/LibGit2Sharp.NativeBinaries/runtimes/linux-x64/native/libgit2-1196807.so)
    	linux-vdso.so.1 (0x00007ffc9d8fa000)
    	libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007f9a3604a000)
    	libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f9a35dd8000)
    	libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f9a35960000)
    	librt.so.1 => /usr/lib/librt.so.1 (0x00007f9a35758000)
    	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f9a3553a000)
    	libc.so.6 => /usr/lib/libc.so.6 (0x00007f9a35194000)
    	libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007f9a34f67000)
    	libpsl.so.5 => /usr/lib/libpsl.so.5 (0x00007f9a34d59000)
    	libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007f9a34b0b000)
    	libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007f9a34826000)
    	libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007f9a345f5000)
    	libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007f9a343ef000)
    	libz.so.1 => /usr/lib/libz.so.1 (0x00007f9a341d8000)
    	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f9a33fd4000)
    	/usr/lib64/ld-linux-x86-64.so.2 (0x0000560a60e83000)
    	libicuuc.so.58 => /usr/lib/libicuuc.so.58 (0x00007f9a33c28000)
    	libicudata.so.58 => /usr/lib/libicudata.so.58 (0x00007f9a32128000)
    	libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007f9a31f1b000)
    	libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007f9a31d15000)
    	libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f9a31aff000)
    	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f9a31777000)
    	libm.so.6 => /usr/lib/libm.so.6 (0x00007f9a31464000)
    	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f9a3124d000)
    

    I can test more, but I need instructions how to proceed. Newer done before, you know.

  16. reopened this on Mar 30, 2017
  17. asbjornu commented on Mar 30, 2017

    @asbjornu
    Member

    @mclang: The only thing I can think of is going through #890 and see if anything written there gives you ideas on how to move forward with this. @eatdrinksleepcode did some work related to this, so he might have some valuable input.

  18. mclang commented on Mar 30, 2017

    @mclang
    Author

    I will check that out, thanks

  19. mclang commented on Apr 25, 2017

    @mclang
    Author

    Could'n get GitVersion working yet, so I will follow @mabead's issue for now.

    Too bad I don't currently have enough time to dig deeper...

  20. mclang commented on Apr 25, 2017

    @mclang
    Author

    Whoa, this was unexpected :O

    I got it working that is... What I did was:

    1. Clone LibGit2Sharp.NativeBinaries and build it
    2. Copy resulting library files under GitVersion Commandline tools directory:
    $ cp ~/projects/libgit2sharp.nativebinaries/libgit2/build/libgit2-1196807.so* ~/projects/fsharp-test/packages/GitVersion.CommandLine/tools/lib/linux/x86_64/
    
    1. Modify LibGit2Sharp.dll.config accordingly:
    <configuration>
      <dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-baa87df" target="lib/linux/x86_64/libgit2-1196807.so" />
      <dllmap os="osx" cpu="x86,x86-64" dll="git2-baa87df" target="lib/osx/libgit2-baa87df.dylib" />
    </configuration>
    

    Note that only the target needs to be changed, leave dll="git2-baa87df" part as it is.

    I hope this workaround helps someone until LibGit2Sharp.NativeBinaries gets fixed.

  21. mclang commented on Apr 25, 2017

    @mclang
    Author

    Even easier method that works at least on Antergos - use libgit2.so provided by the system:

    <configuration>
      <dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-baa87df" target="/usr/lib/libgit2.so" />
      <dllmap os="osx" cpu="x86,x86-64" dll="git2-baa87df" target="lib/osx/libgit2-baa87df.dylib" />
    </configuration>
    
  22. asbjornu commented on Apr 25, 2017

    @asbjornu
    Member

    @mclang: Thanks for the valuable information! Any idea how we can permanently fix this in GitVersion?

  23. mclang commented on Apr 26, 2017

    @mclang
    Author

    Tough question because my case may be some kind of corner case.

    Only thing that I can think of is if you can either change the target to point to the library installed on the system, or make a symbolic link to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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