Skip to content

Conversation

@matt-richardson
Copy link
Contributor

@matt-richardson matt-richardson commented Jan 19, 2022

Recently, it seems that LibGit2Sharp has fixed the bit where it's not pulling in the native library properly.

This PR bumps from 0.27.0-preview-0116 to 0.27.0-preview-0158, to get the fix mentioned in this comment - GitTools/GitVersion#2916 (comment)

The below log excerpts are from building our Caching library.

before:

% dotnet tool run nuke
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Microsoft (R) .NET Core SDK version 6.0.101
/Users/anon/dev/Octopus/Caching/build/Build.cs(56,13): warning CS0618: 'Logger.Info(string, params object[])' is obsolete: 'Use Serilog.Log.Information instead' [/Users/anon/dev/Octopus/Caching/build/_build.csproj]
​
███╗   ██╗██╗   ██╗██╗  ██╗███████╗
████╗  ██║██║   ██║██║ ██╔╝██╔════╝
██╔██╗ ██║██║   ██║█████╔╝ █████╗  
██║╚██╗██║██║   ██║██╔═██╗ ██╔══╝  
██║ ╚████║╚██████╔╝██║  ██╗███████╗
╚═╝  ╚═══╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝
​
NUKE Execution Engine version 6.0.1 (OSX,.NETCoreApp,Version=v5.0)
​
16:11:48 [INF] > /opt/homebrew/bin/dotnet /Users/anon/.nuget/packages/octoversion.tool/0.2.948/tools/net6.0/any/OctoVersion.Tool.dll octoversion --CurrentBranch main --DetectEnvironment True --OutputJsonFile /Users/anon/dev/Octopus/Caching/.nuke/temp/octoversion.a3e0fb17-8e57-4de5-8146-7a5a5c1b5539.json
16:11:48 [DBG] [16:11:48 DBG] Running OctoVersion 0.2.948+Branch.main.Sha.1360c18236bbde1873729a3579e48a647d3f1fba with AppSettings {CurrentBranch="main", NonPreReleaseTags=["refs/heads/main", "refs/heads/master"], NonPreReleaseTagsRegex="", RepositoryPath="", Major=null, Minor=null, Patch=null, PreReleaseTag=null, BuildMetadata=null, FullSemVer=null, OutputFormats=[], DetectEnvironment=True, OutputJsonFile="/Users/anon/dev/Octopus/Caching/.nuke/temp/octoversion.a3e0fb17-8e57-4de5-8146-7a5a5c1b5539.json"}
16:11:48 [DBG] [16:11:48 DBG] Executing in /Users/anon/dev/Octopus/Caching
16:11:48 [DBG] [16:11:48 DBG] Writing build output using JsonFileOutputFormatter
16:11:48 [DBG] [16:11:48 INF] Beginning operation 7cf4de41-5a58-4d32-a0e0-742c3d32a194: Calculating version
16:11:48 [ERR] Unhandled exception. System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
16:11:48 [ERR]  ---> System.DllNotFoundException: Unable to load shared library 'git2-6777db8' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libgit2-6777db8, 0x0001): tried: 'libgit2-6777db8' (no such file), '/usr/local/lib/libgit2-6777db8' (no such file), '/usr/lib/libgit2-6777db8' (no such file), '/Users/anon/dev/Octopus/Caching/libgit2-6777db8' (no such file), '/usr/local/lib/libgit2-6777db8' (no such file), '/usr/lib/libgit2-6777db8' (no such file)
16:11:48 [ERR]    at LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
16:11:48 [ERR]    at LibGit2Sharp.Core.NativeMethods.InitializeNativeLibrary()
16:11:48 [ERR]    at LibGit2Sharp.Core.NativeMethods..cctor()
16:11:48 [ERR]    --- End of inner exception stack trace ---
16:11:48 [ERR]    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs)
16:11:48 [ERR]    at LibGit2Sharp.Core.Proxy.<>c__DisplayClass221_0.<git_repository_discover>b__0(GitBuf buf)
16:11:48 [ERR]    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever)
16:11:48 [ERR]    at LibGit2Sharp.Core.Proxy.git_repository_discover(FilePath start_path)
16:11:48 [ERR]    at LibGit2Sharp.Repository.Discover(String startingPath)
16:11:48 [ERR]    at OctoVersion.Core.VersionNumberCalculation.VersionCalculatorFactory..ctor(String repositorySearchPath) in /opt/buildagent/work/fe69bdc7275df075/source/OctoVersion.Core/VersionNumberCalculation/VersionCalculatorFactory.cs:line 16
16:11:48 [ERR]    at OctoVersion.Core.OctoVersionRunner.Run(OctoVersionInfo& versionInfo) in /opt/buildagent/work/fe69bdc7275df075/source/OctoVersion.Core/OctoVersionRunner.cs:line 64
16:11:48 [ERR]    at OctoVersion.Tool.Program.Main(String[] args) in /opt/buildagent/work/fe69bdc7275df075/source/OctoVersion.Tool/Program.cs:line 14
16:11:48 [WRN] Exception has been thrown by the target of an invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> Nuke.Common.Tooling.ProcessException: Process 'dotnet' exited with code 134.
   > /opt/homebrew/bin/dotnet /Users/anon/.nuget/packages/octoversion.tool/0.2.948/tools/net6.0/any/OctoVersion.Tool.dll octoversion --CurrentBranch main --DetectEnvironment True --OutputJsonFile /Users/anon/dev/Octopus/Caching/.nuke/temp/octoversion.a3e0fb17-8e57-4de5-8146-7a5a5c1b5539.json
   @ /Users/anon/dev/Octopus/Caching
Error output:
   Unhandled exception. System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
    ---> System.DllNotFoundException: Unable to load shared library 'git2-6777db8' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libgit2-6777db8, 0x0001): tried: 'libgit2-6777db8' (no such file), '/usr/local/lib/libgit2-6777db8' (no such file), '/usr/lib/libgit2-6777db8' (no such file), '/Users/anon/dev/Octopus/Caching/libgit2-6777db8' (no such file), '/usr/local/lib/libgit2-6777db8' (no such file), '/usr/lib/libgit2-6777db8' (no such file)
      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_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs)
      at LibGit2Sharp.Core.Proxy.<>c__DisplayClass221_0.<git_repository_discover>b__0(GitBuf buf)
      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 OctoVersion.Core.VersionNumberCalculation.VersionCalculatorFactory..ctor(String repositorySearchPath) in /opt/buildagent/work/fe69bdc7275df075/source/OctoVersion.Core/VersionNumberCalculation/VersionCalculatorFactory.cs:line 16
      at OctoVersion.Core.OctoVersionRunner.Run(OctoVersionInfo& versionInfo) in /opt/buildagent/work/fe69bdc7275df075/source/OctoVersion.Core/OctoVersionRunner.cs:line 64
      at OctoVersion.Tool.Program.Main(String[] args) in /opt/buildagent/work/fe69bdc7275df075/source/OctoVersion.Tool/Program.cs:line 14

   at Nuke.Common.Tooling.ProcessExtensions.AssertZeroExitCode(IProcess process)
   at Nuke.Common.Tools.OctoVersion.OctoVersionTasks.OctoVersionGetVersion(OctoVersionGetVersionSettings toolSettings)
   at Nuke.Common.Tools.OctoVersion.OctoVersionTasks.OctoVersionGetVersion(Configure`1 configurator)
   at Nuke.Common.Tools.OctoVersion.OctoVersionAttribute.GetValue(MemberInfo member, Object instance)
   at Nuke.Common.ValueInjection.ValueInjectionAttributeBase.<>c__DisplayClass0_0.<TryGetValue>b__0()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at Nuke.Common.ControlFlow.SuppressErrorsIf(Boolean condition, Delegate action, Object defaultValue, Boolean includeStackTrace, Boolean logWarning)
​
╬══════════
║ Clean
╬══
​
16:11:48 [INF] Deleting directory /Users/anon/dev/Octopus/Caching/source/Tests/bin...
16:11:48 [INF] Deleting directory /Users/anon/dev/Octopus/Caching/source/Caching/bin...
16:11:48 [INF] Deleting directory /Users/anon/dev/Octopus/Caching/source/Tests/obj...
16:11:48 [INF] Deleting directory /Users/anon/dev/Octopus/Caching/source/Caching/obj...
16:11:48 [INF] Cleaning directory /Users/anon/dev/Octopus/Caching/artifacts...

after

% dotnet tool run nuke
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Microsoft (R) .NET Core SDK version 6.0.101
/Users/anon/dev/Octopus/Caching/build/Build.cs(56,13): warning CS0618: 'Logger.Info(string, params object[])' is obsolete: 'Use Serilog.Log.Information instead' [/Users/anon/dev/Octopus/Caching/build/_build.csproj]
​
███╗   ██╗██╗   ██╗██╗  ██╗███████╗
████╗  ██║██║   ██║██║ ██╔╝██╔════╝
██╔██╗ ██║██║   ██║█████╔╝ █████╗  
██║╚██╗██║██║   ██║██╔═██╗ ██╔══╝  
██║ ╚████║╚██████╔╝██║  ██╗███████╗
╚═╝  ╚═══╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝
​
NUKE Execution Engine version 6.0.1 (OSX,.NETCoreApp,Version=v5.0)
​
18:25:48 [INF] > /opt/homebrew/bin/dotnet /Users/anon/.nuget/packages/octoversion.tool/0.2.961-mattr-bump-libgit2sharp/tools/net6.0/any/OctoVersion.Tool.dll octoversion --CurrentBranch main --DetectEnvironment True --OutputJsonFile /Users/anon/dev/Octopus/Caching/.nuke/temp/octoversion.c051bbf8-6be9-402d-93b0-7e1dadce4c91.json
18:25:48 [DBG] [18:25:48 DBG] Running OctoVersion 0.2.961-mattr-bump-libgit2sharp+Branch.mattr-bump-libgit2sharp.Sha.52662b79f8c9ff5656fd4039a0eae699fe82aaf2 with AppSettings {CurrentBranch="main", NonPreReleaseTags=["refs/heads/main", "refs/heads/master"], NonPreReleaseTagsRegex="", RepositoryPath="", Major=null, Minor=null, Patch=null, PreReleaseTag=null, BuildMetadata=null, FullSemVer=null, OutputFormats=[], DetectEnvironment=True, OutputJsonFile="/Users/anon/dev/Octopus/Caching/.nuke/temp/octoversion.c051bbf8-6be9-402d-93b0-7e1dadce4c91.json"}
18:25:48 [DBG] [18:25:48 DBG] Executing in /Users/anon/dev/Octopus/Caching
18:25:48 [DBG] [18:25:48 DBG] Writing build output using JsonFileOutputFormatter
18:25:48 [DBG] [18:25:48 INF] Beginning operation a81c3fce-15b1-49d3-afd5-ebef76be68a3: Calculating version
18:25:48 [DBG] [18:25:48 DBG] Located Git repository in /Users/anon/dev/Octopus/Caching/.git/
18:25:48 [DBG] [18:25:48 INF] Beginning operation 49285427-cfcd-4f3a-9de4-1399558fb940: Loading commits
18:25:48 [DBG] [18:25:48 DBG] Repository contains 41 commits
18:25:48 [DBG] [18:25:48 INF] Completed operation 49285427-cfcd-4f3a-9de4-1399558fb940: Loading commits in 00:00:00.0652381 (65 ms)
18:25:48 [DBG] [18:25:48 INF] Beginning operation 067b9637-be2c-47e5-a82f-2c67b922abc4: Mapping commits into internal representation
18:25:48 [DBG] [18:25:48 INF] Completed operation 067b9637-be2c-47e5-a82f-2c67b922abc4: Mapping commits into internal representation in 00:00:00.0033310 (3 ms)
18:25:48 [DBG] [18:25:48 INF] Beginning operation 3d5b7217-e471-41b4-a776-f0fb7738780c: Establishing parent/child relationships
18:25:48 [DBG] [18:25:48 INF] Completed operation 3d5b7217-e471-41b4-a776-f0fb7738780c: Establishing parent/child relationships in 00:00:00.0014377 (1 ms)
18:25:48 [DBG] [18:25:48 INF] Beginning operation 5b2109cb-ac00-4ab9-a578-57ef4147876a: Loading tags
18:25:48 [DBG] [18:25:48 DBG] Repository contains 0 tags
18:25:48 [DBG] [18:25:48 INF] Completed operation 5b2109cb-ac00-4ab9-a578-57ef4147876a: Loading tags in 00:00:00.0023699 (2 ms)
18:25:48 [DBG] [18:25:48 INF] Beginning operation 100b42ee-4c09-4679-a1be-c1d643f759fa: Applying relevant version tags to each commit
18:25:48 [DBG] [18:25:48 INF] Completed operation 100b42ee-4c09-4679-a1be-c1d643f759fa: Applying relevant version tags to each commit in 00:00:00.0000004 (0 ms)
18:25:48 [DBG] [18:25:48 DBG] Using pre-release tag main
18:25:48 [DBG] [18:25:48 DBG] Using build metadata Branch.main.Sha.10f3b9d4b443ca662f467a702cfb6493742917b2
18:25:48 [DBG] [18:25:48 INF] Completed operation a81c3fce-15b1-49d3-afd5-ebef76be68a3: Calculating version in 00:00:00.4717935 (471 ms)
18:25:48 [DBG] [18:25:48 INF] Version is 0.0.40-main
18:25:48 [DBG] [18:25:48 INF] Writing version info to /Users/anon/dev/Octopus/Caching/.nuke/temp/octoversion.c051bbf8-6be9-402d-93b0-7e1dadce4c91.json
18:25:49 [INF] Deleting file /Users/anon/dev/Octopus/Caching/.nuke/temp/octoversion.c051bbf8-6be9-402d-93b0-7e1dadce4c91.json...
​
╬══════════
║ Clean
╬══
​
18:25:49 [INF] Deleting directory /Users/anon/dev/Octopus/Caching/source/Tests/obj...
18:25:49 [INF] Deleting directory /Users/anon/dev/Octopus/Caching/source/Caching/obj...
18:25:49 [INF] Cleaning directory /Users/anon/dev/Octopus/Caching/artifacts...

To hopefully get the version that has native libaries pulled in nicely. Relates to libgit2/libgit2sharp#1921
@matt-richardson matt-richardson self-assigned this Jan 19, 2022
@matt-richardson matt-richardson marked this pull request as ready for review January 19, 2022 07:26
Copy link
Contributor

@uglybugger uglybugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@matt-richardson matt-richardson merged commit b1e3241 into main Jan 19, 2022
@matt-richardson matt-richardson deleted the mattr/bump-libgit2sharp branch January 19, 2022 23:55
edlyn-liew pushed a commit that referenced this pull request Jun 3, 2024
To get the version that has native libaries pulled in nicely. Relates to libgit2/libgit2sharp#1921
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

Successfully merging this pull request may close these issues.

2 participants