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

Apple Silicon support #165

Open
maludwig opened this issue Aug 19, 2022 · 7 comments
Open

Apple Silicon support #165

maludwig opened this issue Aug 19, 2022 · 7 comments

Comments

@maludwig
Copy link

Hey friends,

So on OSX, on the new Apple Silicon chips (M1 / M2) etc, there is a bug that libgit2sharp fixed here:

https://github.com/libgit2/libgit2sharp/pull/1955/files

Discussion is here:

libgit2/libgit2sharp#1955

I'm having trouble using Cake_Git on my M2 Macbook Air, and it seems like simply updating libgit2sharp would be sufficient to resolve the issue. But I'm not smart enough to figure this out on my own.

LibGit2Sharp 0.27.0-preview-0182 includes this change, so it should just be a matter of:

dotnet add package LibGit2Sharp --version 0.27.0-preview-0182

and then it's all fixed. Hopefullly.

I'm happy to help test fixes with my macbook.

@devlead
Copy link
Member

devlead commented Aug 19, 2022

Probably it's just a matter of changing these lines

<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0102" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.312" />

to

<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0182" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.315" />

Would you like to take stab at creating a PR with the above changes?

@maludwig
Copy link
Author

Happily.

@maludwig
Copy link
Author

Hmm, just changing those two lines doesn't seem to make my tests pass. I'm getting this error and I don't understand what it means:


$ ./build.sh 
++ dirname ./build.sh
+ cd .
+ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
+ export DOTNET_CLI_TELEMETRY_OPTOUT=1
+ DOTNET_CLI_TELEMETRY_OPTOUT=1
+ export DOTNET_NOLOGO=1
+ DOTNET_NOLOGO=1
+ dotnet tool restore
Tool 'cake.tool' (version '2.0.0') was restored. Available commands: dotnet-cake

Restore was successful.
+ dotnet cake

----------------------------------------
Setup
----------------------------------------
Building Release version 2.0.0 of Cake.Git (2.0.0), IsMainBranch: False, Publish: False.

========================================
Clean
========================================
Cleaning /Users/mitchellludwig/dev/Cake_Git/src
Cleaning /Users/mitchellludwig/dev/Cake_Git/nuget
Cleaning /Users/mitchellludwig/dev/Cake_Git/artifacts

========================================
Restore
========================================
Restoring /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git.sln...
  Determining projects to restore...
  Restored /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj (in 87 ms).

========================================
SolutionInfo
========================================

========================================
Build
========================================
Building /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git.sln
MSBuild version 17.3.0+92e077650 for .NET
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/bin/Release/net6.0/Cake.Git.dll
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/bin/Release/net5.0/Cake.Git.dll
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/bin/Release/netcoreapp3.1/Cake.Git.dll

Build succeeded.

/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
    15 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.61

========================================
Publish-Artifacts
========================================
MSBuild version 17.3.0+92e077650 for .NET
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/bin/Debug/netcoreapp3.1/Cake.Git.dll
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/artifacts/netcoreapp3.1/
MSBuild version 17.3.0+92e077650 for .NET
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/bin/Debug/net5.0/Cake.Git.dll
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/artifacts/net5.0/
MSBuild version 17.3.0+92e077650 for .NET
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(136,36): warning CS3003: Type of 'GitFetchSettings.RefSpecFilter' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Fetch.cs(142,30): warning CS3003: Type of 'GitFetchSettings.TagFetchMode' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitBranch.cs(51,37): warning CS3001: Argument type 'Repository' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(27,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/GitAliases.Tags.cs(55,33): warning CS3002: Return type of 'GitAliases.GitTags(ICakeContext, DirectoryPath, bool)' is not CLS-compliant [/Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/Cake.Git.csproj]
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/src/Cake.Git/bin/Debug/net6.0/Cake.Git.dll
  Cake.Git -> /Users/mitchellludwig/dev/Cake_Git/artifacts/net6.0/

========================================
Create-NuGet-Package
========================================
Attempting to build package from 'Cake.Git.temp.nuspec'.
Successfully created package '/Users/mitchellludwig/dev/Cake_Git/nuget/Cake.Git.2.0.0.nupkg'.

========================================
Test
========================================
Testing netcoreapp3.1

----------------------------------------
Setup
----------------------------------------
Running tasks...
Testing version 2.0.0 of Cake Git Addin (2.0.0).

========================================
Clean
========================================

========================================
Git-Init
========================================
Creating repository...
An error occurred when executing task 'Git-Init'.

----------------------------------------
Teardown
----------------------------------------
Finished running tasks.
Trying to clean up test repo /Users/mitchellludwig/dev/Cake_Git/TestRepo
Successfully cleaned test repo /Users/mitchellludwig/dev/Cake_Git/TestRepo
Error: One or more errors occurred. (The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.)
	The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
An error occurred when executing task 'Test'.

----------------------------------------
Teardown
----------------------------------------
Finished running tasks.
Error: One or more errors occurred. (.NET CLI: Process returned an error (exit code 1).)
	.NET CLI: Process returned an error (exit code 1).

@devlead
Copy link
Member

devlead commented Aug 20, 2022

Could you create a draft PR? So we can see if it fails on CI too? Might be that we need to add some runtime folders.

Worst case we'll need upcoming Cake 2.3 as it will have native library improvements.

@maludwig
Copy link
Author

Here you go, I think you need to manually run the CI for me.

@maludwig
Copy link
Author

Yep OSX CI is also dying. Same error. Any ideas?

@pascalberger
Copy link
Member

pascalberger commented Mar 7, 2024

Version 4 introduced a separate addin for Cake Frosting (Cake.Frosting.Git) which references LibGit2Sharp instead of repackaging it and therefore should also work with Silicon chips.

We should keep this issue open to track progress for Cake Scripting using Cake.Git addin.

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

3 participants