Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run GitVersion in Mono? #1263

Closed
dermeister0 opened this issue Jul 19, 2017 · 2 comments
Closed

How to run GitVersion in Mono? #1263

dermeister0 opened this issue Jul 19, 2017 · 2 comments

Comments

@dermeister0
Copy link

dermeister0 commented Jul 19, 2017

I tried to run GitVersion in Docker.

Debian Stretch:

FROM microsoft/aspnetcore-build:2.0.0-preview2

RUN apt-get update && apt-get install -y unzip mono-runtime libmono-system-core4.0-cil && \
    curl -L -o /tmp/GitVersion_3.6.5.zip https://github.com/GitTools/GitVersion/releases/download/v3.6.5/GitVersion_3.6.5.zip && \
    unzip -d /opt/GitVersion /tmp/GitVersion_3.6.5.zip && \
    rm /tmp/GitVersion_3.6.5.zip
root@39806c64d80e:/# mono /opt/GitVersion/GitVersion.exe
INFO [07/19/17 6:55:26:73] Working directory: /
INFO [07/19/17 6:55:26:74] IsDynamicGitRepository: False
ERROR [07/19/17 6:55:26:75] 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 [07/19/17 6:55:26:75]
INFO [07/19/17 6:55:26:75] Attempting to show the current git graph (please include in issue):
INFO [07/19/17 6:55:26:75] Showing max of 100 commits
ERROR [07/19/17 6:55:26:76] Couldn't dump the git graph due to the following error: System.TypeInitializationException: The type initializer for 'GitTools.LibGitExtensions' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly or one of its dependencies.
  at GitTools.Logging.LogProvider.GetLogger (System.String name) [0x00000] in <57cedcc684654481ace045b6d7bcc156>:0
  at GitTools.Logging.LogProvider.GetLogger (System.Type type) [0x00006] in <57cedcc684654481ace045b6d7bcc156>:0
  at GitTools.Logging.LogProvider.GetCurrentClassLogger () [0x00011] in <57cedcc684654481ace045b6d7bcc156>:0
  at GitTools.LibGitExtensions..cctor () [0x00000] in <57cedcc684654481ace045b6d7bcc156>:0
   --- End of inner exception stack trace ---
  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

root@5f2b3625a654:/# mono --version
Mono JIT compiler version 4.6.2 (Debian 4.6.2.7+dfsg-1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

root@5f2b3625a654:/# cat /etc/debian_version
9.0
@dermeister0 dermeister0 changed the title How to run GitVersion in Mono How to run GitVersion in Mono? Jul 19, 2017
@dermeister0
Copy link
Author

dermeister0 commented Jul 19, 2017

It worked when I installed libgit2 library from repository and manually edited LibGit2Sharp.dll.config file.

apt-get install libgit2-24
<configuration>
    <dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-baa87df" target="/usr/lib/x86_64-linux-gnu/libgit2.so.24" />
    <dllmap os="osx" cpu="x86,x86-64" dll="git2-baa87df" target="lib/osx/libgit2-baa87df.dylib" />
</configuration>

#1097 (comment)

@dermeister0
Copy link
Author

FROM microsoft/aspnetcore-build:2.0.0-preview2

RUN apt-get update && apt-get install -y unzip mono-runtime libmono-system-core4.0-cil libgit2-24 && \
    curl -L -o /tmp/GitVersion_3.6.5.zip https://github.com/GitTools/GitVersion/releases/download/v3.6.5/GitVersion_3.6.5.zip && \
    unzip -d /opt/GitVersion /tmp/GitVersion_3.6.5.zip && \
    rm /tmp/GitVersion_3.6.5.zip && \
    echo '<configuration><dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-baa87df" target="/usr/lib/x86_64-linux-gnu/libgit2.so.24" /></configuration>' > \
    /opt/GitVersion/LibGit2Sharp.dll.config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant