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

Support linux arm64/aarch64 architecture #25

Closed
nbaztec opened this issue Jan 18, 2022 · 13 comments
Closed

Support linux arm64/aarch64 architecture #25

nbaztec opened this issue Jan 18, 2022 · 13 comments
Assignees
Labels
architecture: arm Specific to ARM host architecture os: linux Specific to Linux operating system status: in progress Work is in progress on this topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@nbaztec
Copy link

nbaztec commented Jan 18, 2022

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

@per1234 per1234 added architecture: arm Specific to ARM host architecture os: linux Specific to Linux operating system status: in progress Work is in progress on this topic: code Related to content of the project itself type: enhancement Proposed improvement labels Jan 18, 2022
@per1234 per1234 self-assigned this Jan 18, 2022
@StephenHodgson
Copy link

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.

@nbaztec
Copy link
Author

nbaztec commented Jan 19, 2022

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?

@StephenHodgson
Copy link

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

@nbaztec
Copy link
Author

nbaztec commented Jan 23, 2022

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.

@StephenHodgson
Copy link

The c# one was the one failing for me

@nbaztec
Copy link
Author

nbaztec commented Jan 25, 2022

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.

@StephenHodgson
Copy link

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

@adamchalmers
Copy link
Contributor

adamchalmers commented Sep 22, 2022

@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
Copy link
Contributor

adamchalmers commented Sep 24, 2022

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

> setup-protoc-action@0.0.0 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

@per1234
Copy link
Contributor

per1234 commented Sep 25, 2022

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.

@adamchalmers
Copy link
Contributor

adamchalmers commented Sep 25, 2022

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?

colinrgodsey added a commit to ergatta/setup-protoc that referenced this issue Nov 2, 2022
0xAlcibiades added a commit to 0xAlcibiades/setup-protoc that referenced this issue Apr 11, 2023
@0xAlcibiades
Copy link

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

@alessio-perugini
Copy link
Contributor

alessio-perugini commented May 29, 2023

Implemented in 1.3.0.
Thanks to @adamchalmers contribution 🥳

/cc @nbaztec @0xAlcibiades

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture: arm Specific to ARM host architecture os: linux Specific to Linux operating system status: in progress Work is in progress on this topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants