XPlat building for m8s - Issues on Linux with nested dependency (Lib2Git)
luisgizirian opened this issue · 4 comments
With macOS (Catalina), building from source worked great for me :)
For Linux, the story is different, mostly because of the difficulty to deal with Lib2Git.NativeBinaries.
Using Ubuntu 19.04 for testing:
(till here, couldn't make it work. Pointing some links that can get you closer)
- GitTools/GitVersion#1744 (comment)
- https://github.com/libgit2/libgit2sharp.nativebinaries (Linux support is experimental, as stated)
- Install cmake
sudo apt-get install cmake
- https://stackoverflow.com/a/27551158 (if issues related to openssl arise)
The error displayed at dotnet build
time:
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly. [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: ---> System.DllNotFoundException: Unable to load shared library '/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/MSBuildCore/../runtimes/linux-x64/native/libgit2-572e4d8.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libssl.so.1.0.0: cannot open shared object file: No such file or directory [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(String unmanagedDllPath) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.LoadUnmanagedDllFromPath(String unmanagedDllPath) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.GitLoaderContext.LoadUnmanagedDll(String unmanagedDllName) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.ResolveUnmanagedDll(String unmanagedDllName, IntPtr gchManagedAssemblyLoadContext) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods..cctor() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: --- End of inner exception stack trace --- [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods.git_libgit2_opts(Int32 option, UInt32 level, String path) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.Proxy.git_libgit2_opts_set_search_path(ConfigurationLevel level, String path) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.GlobalSettings.SetConfigSearchPaths(ConfigurationLevel level, String[] paths) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.GitExtensions.OpenGitRepo(String pathUnderGitRepo, Boolean useDefaultConfigSearchPaths) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.VersionOracle.Create(String projectDirectory, String gitRepoDirectory, ICloudBuild cloudBuild, Nullable`1 overrideBuildNumberOffset, String projectPathRelativeToGitRepoRoot) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
Build FAILED.
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly. [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: ---> System.DllNotFoundException: Unable to load shared library '/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/MSBuildCore/../runtimes/linux-x64/native/libgit2-572e4d8.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libssl.so.1.0.0: cannot open shared object file: No such file or directory [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.InternalLoadUnmanagedDllFromPath(String unmanagedDllPath) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.LoadUnmanagedDllFromPath(String unmanagedDllPath) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.GitLoaderContext.LoadUnmanagedDll(String unmanagedDllName) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at System.Runtime.Loader.AssemblyLoadContext.ResolveUnmanagedDll(String unmanagedDllName, IntPtr gchManagedAssemblyLoadContext) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods.git_libgit2_init() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods..cctor() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: --- End of inner exception stack trace --- [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.NativeMethods.git_libgit2_opts(Int32 option, UInt32 level, String path) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.Core.Proxy.git_libgit2_opts_set_search_path(ConfigurationLevel level, String path) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at LibGit2Sharp.GlobalSettings.SetConfigSearchPaths(ConfigurationLevel level, String[] paths) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.GitExtensions.OpenGitRepo(String pathUnderGitRepo, Boolean useDefaultConfigSearchPaths) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.VersionOracle.Create(String projectDirectory, String gitRepoDirectory, ICloudBuild cloudBuild, Nullable`1 overrideBuildNumberOffset, String projectPathRelativeToGitRepoRoot) [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
/home/user/.nuget/packages/nerdbank.gitversioning/3.0.28/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018: at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner() [/home/user/src/Micronetes/src/Micronetes.Hosting.Runtime/Micronetes.Hosting.Runtime.csproj]
0 Warning(s)
1 Error(s)
Workaround: if you just need to run m8s in Linux for testing its orchestration capabilities, going for the dotnet tool install
gets you there. https://github.com/davidfowl/Micronetes#using-ci-builds
Ugh is right. Every time a new linux distro is released we have to chase down (and usually drive creation of) a new libgit2sharp and libgit2sharp.nativebinaries package pair that is prepared to link with whatever SSL package shipped in that distro. Ironically, we don't ever do remote connections so SSL is irrelevant, but it's part of our dependency.
You can see the active bugs we have on it here. I don't see Ubuntu 19 mentioned among them. This might be fixed in our master
branch already.
A quick and dirty workaround to build src
and samples
from scratch into a Linux box where nerdbank.gitversioning
issues appear, is to temporarily disable the Directory.build.props
(i.e. by renaming the file at root folder - please make sure to avoid propagating this change into any PR - )
I'll close this issue for now.