GitVersion: LibGit2Sharp.Core.NativeMethods cannot be initialized: Unable to load shared library 'git2-7ce88e6' or one of its dependencies
Trying to use GitVersion dotnet tool with .net core 3 sdk docker image that runs on GitLab Shared Runner (which is CoreOS).
The 5.0.2-beta.1+95
(contains https://github.com/GitTools/GitVersion/pull/1849) throws this exception:
Using Docker executor with image mcr.microsoft.com/dotnet/core/sdk:3.0 ...
Pulling docker image mcr.microsoft.com/dotnet/core/sdk:3.0 ...
Using docker image sha256:4422e7fb740c14af167b232a7b485d60a1a696a6507ee75e712817bd27dacdb5 for mcr.microsoft.com/dotnet/core/sdk:3.0 ...
...
$ dotnet tool restore
Tool 'gitversion.tool' (version '5.0.2-beta1.95') was restored. Available commands: dotnet-gitversion
Restore was successful.
$ dotnet tool run dotnet-gitversion /updateassemblyinfo /ensureassemblyinfo
INFO [10/10/19 18:18:06:48] Working directory: /builds/nZeus/my-project/sources
INFO [10/10/19 18:18:06:49] IsDynamicGitRepository: False
ERROR [10/10/19 18:18:06:51] An unexpected error occurred:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'git2-7ce88e6' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgit2-7ce88e6: cannot open shared object file: No such file or directory
at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
at LibGit2Sharp.Core.NativeMethods..cctor()
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.NativeMethods.git_buf_dispose(GitBuf buf)
at LibGit2Sharp.Core.Proxy.git_buf_dispose(GitBuf buf)
at LibGit2Sharp.Core.Handles.GitBuf.Dispose()
at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever)
at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path)
at LibGit2Sharp.Repository.Discover(String startingPath)
at GitVersion.GitPreparer.GetProjectRootDirectory() in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 160
at GitVersion.Configuration.ConfigFileLocator.Verify(GitPreparer gitPreparer, IFileSystem fileSystem) in D:\a\1\s\src\GitVersionCore\Configuration\ConfigFileLocator.cs:line 56
at GitVersion.Program.VerifyConfiguration(Arguments arguments, IFileSystem fileSystem) in D:\a\1\s\src\GitVersionExe\Program.cs:line 155
at GitVersion.Program.VerifyArgumentsAndRun() in D:\a\1\s\src\GitVersionExe\Program.cs:line 101
INFO [10/10/19 18:18:06:52]
INFO [10/10/19 18:18:06:52] Attempting to show the current git graph (please include in issue):
INFO [10/10/19 18:18:06:52] Showing max of 100 commits
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 31 (11 by maintainers)
Commits related to this issue
- CircleCI: attempted workaround for GitTools/GitVersion/issues/1852 — committed to Sebazzz/PokerTime by Sebazzz 4 years ago
- Fix some CI issues that occurred with GitVersion Notable issues: AppVeyor and parallel build: https://github.com/GitTools/GitVersion/issues/1381 Shared library issues on CircleCI / Debian 10+: https:... — committed to Sebazzz/PokerTime by Sebazzz 4 years ago
- Fix some CI issues that occurred with GitVersion Notable issues: AppVeyor and parallel build: https://github.com/GitTools/GitVersion/issues/1381 Shared library issues on CircleCI / Debia... — committed to Sebazzz/Return by Sebazzz 4 years ago
- Fix some CI issues that occurred with GitVersion Notable issues: AppVeyor and parallel build: https://github.com/GitTools/GitVersion/issues/1381 Shared library issues on CircleCI / Debian 10+: https:... — committed to Sebazzz/PokerTime by Sebazzz 4 years ago
- GH-1852 updated LibGit2Sharp to 0.27.0-preview-0034 — committed to arturcic/GitVersion by arturcic 4 years ago
- GH-1852 updated LibGit2Sharp to 0.27.0-preview-0034 — committed to GitTools/GitVersion by arturcic 4 years ago
Temporary solution for Docker:
I think I will update Libgit2Sharp to preview version and will release it as 5.3.2
@robertcoltheart If you use GitVersion as tool, this
Dockerfile
should helps:as I mentioned https://github.com/GitTools/GitVersion/issues/1824#issuecomment-540716967 the debian 10 is not yet supported. I’ll need to think of a way to make it supported
I commented on the the LibGit2Sharp issue as well, but I don’t think we’ll be doing a non-preview release any time soon. The work in that PR is mostly a patch to a larger problem that is still being worked on. Even using the preview release that includes that change, there are more Linux distros out there supported by .NET Core that won’t work with LibGit2Sharp.
The real fix is to move the support for https into managed code, and that work is ongoing, though progressing slowly.
@robertcoltheart , currently we are almost ready to release 5.3.0. I would prefer to use a stable version of LibGit2Sharp in this release instead of using a preview. But depending on the response https://github.com/libgit2/libgit2sharp/pull/1741#issuecomment-623280758 we might consider using the preview as well
It seems guys have figured out a root cause https://github.com/libgit2/libgit2sharp/pull/1741
See this discussion https://github.com/libgit2/libgit2sharp/pull/1732
I guess now it is required a new release to be built.
Also spotted on Ubuntu 19.04+libcurl4