Skip to content

Fix protoc support on M1 mac - #20058

Merged
kaos merged 1 commit into
pantsbuild:mainfrom
gauthamnair:fix-m1-protoc
Oct 20, 2023
Merged

Fix protoc support on M1 mac#20058
kaos merged 1 commit into
pantsbuild:mainfrom
gauthamnair:fix-m1-protoc

Conversation

@gauthamnair

Copy link
Copy Markdown
Contributor

The known version that comes with pants does not support M1 mac and errors out with:

bash: bin/protoc: Bad CPU type in executable

this is because the published artifact for macos_arm64 for this version of protoc does not actually support arm64 protocolbuffers/protobuf#9893 (comment).

This pr adds default versions for a more recent version of protoc where the Mac M1 artifact works. Tested it with example-codegen. Did not change the default_version.

Outputs of a script to download and get shas/byte count:

83ac000ff540e242b6a2ff221a3ac88d2d8e55443801b7a28e9697e5f40e8937  protoc-24.4-linux-aarch_64.zip
 2971447 protoc-24.4-linux-aarch_64.zip

5871398dfd6ac954a6adebf41f1ae3a4de915a36a6ab2fd3e8f2c00d45b50dec  protoc-24.4-linux-x86_64.zip
 3005774 protoc-24.4-linux-x86_64.zip

d80544480397fe8a05d966fba291cf1233ad0db0ebc24ec72d7bd077d6e7ac59  protoc-24.4-osx-aarch_64.zip
 2088802 protoc-24.4-osx-aarch_64.zip

6c3b6bf4038d733b6d31f1cc4516a656570b5b5aafb966b650f8182afd0b98cf  protoc-24.4-osx-x86_64.zip
 2121366 protoc-24.4-osx-x86_64.zip

@gauthamnair gauthamnair added the category:bugfix Bug fixes for released features label Oct 19, 2023
@gauthamnair gauthamnair changed the title Add a version of protoc supporting arm Mac Fix protoc support on M1 mac Oct 19, 2023
@gauthamnair
gauthamnair requested a review from kaos October 19, 2023 20:24
@kaos
kaos merged commit 9b8153e into pantsbuild:main Oct 20, 2023
huonw added a commit that referenced this pull request Nov 2, 2023
As pointed out by @huonw in
#20107 (comment)

Removing support for tool versions on mac because they don't have x86
binaries was premature and can cause regressions for users who are
running rosetta. We've recently merged a few changes having to do with
trying to make arm binaries available to mac users:

- #19945 (shellcheck) This one
is fine because it did not drop support for any versions.
- #20058 (protoc). This dropped
support for the default version on apple silicon. This is an error,
because the version seems to work fine with Rosetta. We revert the
version-dropping here.
- #19940 (coursier). This is
very tricky. We dropped support for some old versions, but made new
versions available and bumped the default version. To support both
native-arm and old versions via rosetta is tricky. Discussed further in
https://github.com/pantsbuild/pants/pull/19940/files#r1375420734

For now we revert the coursier fix as discussed in
#19940 (comment) in
a separate PR: #20120

A fix-forward for coursier is available at
#20121

Co-authored-by: Huon Wilson <huon@exoflare.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:bugfix Bug fixes for released features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants