How to support Apple Silicon/M1 development

akka-grpc currently does not support code generation on Apple Silicon/M1 - it uses the protoc-jar 1 project, and this does not currently support the aarch_64 platform.

Normally I would just create PRs to add this support to protoc-jar and then akka-grpc, but a PR to add support to protoc-jar 2 has been sitting since Jan 2021, and comments on that PR and others make it clear the maintainer is intentionally not merging PRs until more sponsorship eventuates.

I’m not litigating the protoc-jar maintainers choice - it’s their project, so up to them how to operate it and where to put their effort.
I do however want to have an M1 native development toolchain for akka-grpc, and protoc-jar is not evolving/updating to newer platforms and protoc-jar versions (last commit is over a year ago now) that would allow that.

Can anyone from the Akka team comment on their plans in this area - am happy to contribute if there is a clear direction the community can get behind.

Tim

with rosetta2 installed I successfully use akka-grpc plugin to generate classes. If plugin version that you use is too old, you can try to add (ThisBuild / PB.protocVersion) := "3.18.0" to build.sbt

to install rosetta use /usr/sbin/softwareupdate --install-rosetta --agree-to-license

I’m talking here about a native toolchain - I’d prefer to avoid dropping in and out of rosetta.

Also not using SBT, but will see if Maven can be convinced to use a different version.

For posterity, the protocVersion can also be overridden in the Maven plugin, albeit a little counter-intuitively:

<plugin>
	<groupId>com.lightbend.akka.grpc</groupId>
	<artifactId>akka-grpc-maven-plugin</artifactId>
	<executions>
		<execution>
			<id>akka-grpc-compile</id>
			<goals>
				<goal>generate</goal>
			</goals>
			<configuration>
				<language>Scala</language>
				<generateClient>true</generateClient>
				<generateServer>true</generateServer>
				<protocVersion>-v${protobuf.version}</protocVersion>
			</configuration>
		</execution>
	</executions>
</plugin>

The version is a bit weird - the Mojo just passes the string straight to the protoc-java command, which expects CLI like syntax.

That addresses my need for now.

Unfortunately before native version of protoc is released upstream - Ensure OSX aarch64 builds are added as assets to our releases · Issue #9397 · protocolbuffers/protobuf · GitHub not much else can be done

Surprising to see problems with this, because after Align protoc versions with protobuf by johanandren · Pull Request #1490 · akka/akka-grpc · GitHub which was merged in Akka gRPC 2.1.2 code generation in both maven and sbt on m1 is working fine for me, without rosetta.

Is there some special circumstances stopping it from working for you?

Ah, it was a temporary issue with the protobuf release, not something inherently broken?