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

protobuf-maven-plugin Config Causes Protoc Execution Error on Linux Systems #11236

Closed
llj37825 opened this issue May 28, 2024 · 5 comments
Closed
Labels

Comments

@llj37825
Copy link

I am facing an issue with the protobuf-maven-plugin in a Spring Boot project that integrates gRPC. The plugin is configured as follows in the pom.xml:

org.xolstice.maven.plugins protobuf-maven-plugin 0.6.1 com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier} The problem arises when the CI/CD pipeline, which runs on a Linux environment, attempts to compile and package the application. The error message indicates that it's trying to execute a .exe file, which is not compatible with Linux:

An error occurred while invoking protoc: Error while executing process.: Cannot run program "protoc-3.7.1-linux-x86_64.exe": error=2, No such file or directory -> [Help 1]
Since Linux cannot execute .exe files, the build fails. How can this issue be resolved to ensure that the protobuf-maven-plugin correctly identifies and uses the appropriate protoc binary for Linux during the process?

@kannanjgithub
Copy link
Contributor

The exe extension is a file format for plugins, as it is a plugin for the protoc compiler and it works on Linux also.
Are you able to invoke the plugin from the command line directly using protoc and providing the downloaded plugin path, for ex., with

protoc --plugin=protoc-gen-grpc-java=/usr/local/homej/Downloads/protoc-gen-grpc-java-1.64.0-linux-x86_64.exe --grpc-java_out=gen-files/ --proto_path=path/to/my/test.proto

I found a similar reported error for Alpine Linux container here. Can you confirm which flavor of Linux you are using?

@ejona86
Copy link
Member

ejona86 commented May 30, 2024

protoc-3.7.1 is really old, from 2019. But I don't think that is likely to be the cause. Can you try using our examples and seeing if they build? https://github.com/grpc/grpc-java/blob/master/examples/pom.xml

FWIW, nothing here is actually grpc-java, as we don't maintain the maven plugin nor protoc itself.

@llj37825
Copy link
Author

protoc-3.7.1 is really old, from 2019. But I don't think that is likely to be the cause. Can you try using our examples and seeing if they build? https://github.com/grpc/grpc-java/blob/master/examples/pom.xml

FWIW, nothing here is actually grpc-java, as we don't maintain the maven plugin nor protoc itself.

System Information:

Linux bd937df84756 5.4.262-1.el7.elrepo.x86_64 #1 SMP Wed Nov 29 00:56:30 EST 2023 x86_64 Linux
Issue:

To verify the existence of the protoc file, I entered the container and found the file protoc-3.17.2-linux-x86_64.exe (I switched the version). Even though the file exists, when I navigate to its directory and execute the command:

bash
protoc-3.17.2-linux-x86_64.exe --version
I still get an error saying the file does not exist. Here are the steps I followed:

Download and unzip the file:

bash
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.17.2/protoc-3.17.2-linux-x86_64.zip
unzip protoc-3.17.2-linux-x86_64.zip -d protoc3

bash
mv protoc3/bin/* /usr/local/bin/
mv protoc3/include/* /usr/local/include/
chmod +x /usr/local/bin/protoc

After performing the above steps, when I execute the command:

bash
protoc --version
I receive the error that the protoc file does not exist.

@ejona86
Copy link
Member

ejona86 commented May 31, 2024

Using com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier} with protobuf-maven-plugin will download the file from Maven Central.

When you copied the file to /usr/local/bin, what was your PATH?

@ejona86
Copy link
Member

ejona86 commented Jun 20, 2024

No response to provide more information, so closing. I'm actually hoping it was resolved and they just didn't get back to us. More information can be provided and then we can reopen.

@ejona86 ejona86 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants