setup-protoc icon indicating copy to clipboard operation
setup-protoc copied to clipboard

Support linux arm64/aarch64 architecture

Open nbaztec opened this issue 3 years ago • 11 comments

The releases for arm64/aarch64 are already provided on the Protobuf releases page https://github.com/protocolbuffers/protobuf/releases and thus can easily be supported

nbaztec avatar Jan 18 '22 12:01 nbaztec

Just tried this a little bit ago but for some reason I'm getting the following:

protoc-gen-grpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.

StephenHodgson avatar Jan 19 '22 05:01 StephenHodgson

Could you provide a step by step please? I tried this in AWS Graviton EC2 instances (linux-arm64) and it seemed to have worked properly.

Could you perhaps be missing the grpc plugin for arm64 instead?

nbaztec avatar Jan 19 '22 19:01 nbaztec

Just used the action as is and tried to generate my plugin as usual.

StephenHodgson avatar Jan 20 '22 02:01 StephenHodgson

Hmm, I can't be sure of your setup but it's possible that the grpc plugin is missing from your setup. I tried the following on the AWS arm64 instances:

syntax = "proto3";

option go_package = "./helloworld";

package helloworld;

// The greeting service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

Generating C++ artifacts wihtout gRPC worked out of the box:

$ protoc --cpp_out=.  helloworld.proto

Generating C++ artifacts with gRPC gave the error that gRPC plugin was missing:

$ protoc --cpp_out=. --cpp_grpc_out=. helloworld.proto
protoc-gen-cpp_grpc: program not found or is not executabl

which could be fixed by building the plugin for C++ via https://github.com/grpc/grpc

I tried the same for go artifacts and I had to download the plugins (for go code generation and gRPC) myself:

$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

After that they worked as well:

$ protoc --go_out=. --go-grpc_out=. helloworld.proto

I'm pretty sure you're missing the gRPC plugin for your language which you can obtain from https://github.com/grpc/grpc

Could be that for x86_64 they're pre-included for some languages, but I can't be sure. For almost all languages that I worked with (Go, Javascript, Python, Java, Kotlin) I'd always had to install the plugins.

nbaztec avatar Jan 23 '22 12:01 nbaztec

The c# one was the one failing for me

StephenHodgson avatar Jan 25 '22 03:01 StephenHodgson

Could you perhaps try installing the Nuget GRPC package as specified here?https://github.com/grpc/grpc/tree/master/src/csharp#how-to-use

To be able to generate code from Protocol Buffer (.proto) file definitions, add the Grpc.Tools NuGet package which provides code generation integrated into your build.

nbaztec avatar Jan 25 '22 09:01 nbaztec

np, I will just use a different action. This doesn't seem to work for my needs out of the box

StephenHodgson avatar Jan 25 '22 18:01 StephenHodgson

@per1234 Hi! Are you still working on this?

I think the erroneous line of the action is here:

const arch: string = osArch == "x64" ? "x86_64" : "x86_32";

I guess the function could be modified to take another parameter which defaults to "x86" (to avoid breaking backwards-compatibility) but lets users request the arm version.

adamchalmers avatar Sep 22 '22 18:09 adamchalmers

I tried working on this myself. I can run npm install and npm run test just fine, all OK, but I get failures on npm run build:

% npm run build

> [email protected] build
> tsc

node_modules/keyv/src/index.d.ts:60:32 - error TS2304: Cannot find name 'AsyncGenerator'.

60  iterator(namespace?: string): AsyncGenerator<any, void, any>;
                                  ~~~~~~~~~~~~~~


Found 1 error.

Any ideas? I'm on WSFL, Ubuntu, using node v16.17.1

adamchalmers avatar Sep 24 '22 18:09 adamchalmers

Hi @adamchalmers. I am not able to reproduce the problem. However, this project use Node.js 12.x, so please use that version for development.

I highly recommend the excellent nvm tool for managing multiple installations of Node.js:

https://github.com/nvm-sh/nvm

I realize it is very unfortunate that the project has not been updated to use the current LTS version of Node.js. I also realize that it is unacceptable that this information is not documented anywhere. I hope we will eventually manage to pay off all the tech debt and make this project something that is maintainable and contributor friendly. But for now we just have to make the best of what we have to work with.

per1234 avatar Sep 25 '22 15:09 per1234

No worries! I tried again using node 12 and I still get the same error when I try to build.

# node --version
v12.16.1
# npm --version
6.13.4

Does this require having a Typescript compiler installed? Are there any other local dependencies whose version I should check?

Update: This was solved by running npm install typescript --save-dev -- not sure if this means the main repo should be modified somehow. Seems to be assuming the presence of typescript, but shouldn't that be installed by npm install?

adamchalmers avatar Sep 25 '22 21:09 adamchalmers

Any word on when this is coming, would be super useful for local actions runs on apple silicon.

0xAlcibiades avatar Apr 11 '23 21:04 0xAlcibiades

Implemented in 1.3.0. Thanks to @adamchalmers contribution :partying_face:

/cc @nbaztec @0xAlcibiades

alessio-perugini avatar May 29 '23 15:05 alessio-perugini