How to Fix GitHub Actions Build Not Finding Protoc?

0
31
Asked By CuriousCat42 On

I'm working on a Rust project that requires `protoc`, the Protobuf compiler, and I'm trying to set it up in my GitHub Actions workflow. Here's what I have:

```yaml
build-test-deploy:
runs-on: ubuntu-latest

...

- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler

- name: Test
run: |
which protoc
export PROTOC=/usr/bin/protoc
```

Under the `env` section, I also set:

```yaml
env:
AWS_REGION: "us-east-2"
...
PROTOC: "/usr/bin/protoc"
```

The command `which protoc` returns the correct path: `/usr/bin/protoc`. Despite this, the build is failing with the error:
```
Error: Custom { kind: NotFound, error: "Could not find `protoc`. If `protoc` is installed, try setting the `PROTOC` environment variable to the path of the `protoc` binary. To install it on Debian, run `apt-get install protobuf-compiler`. It is also available at https://github.com/protocolbuffers/protobuf/releases For more information: https://docs.rs/prost-build/#sourcing-protoc" }
```

I'm feeling a bit stuck here and looking for any advice or tips!

2 Answers

Answered By DevGuru123 On

You might want to check out the `arduino/setup-protoc` GitHub Action. It's specifically made for setting up `protoc`, and it could simplify your workflow. I've heard mixed results, but it's worth a shot!

Answered By HelpfulHacker99 On

Have you tried adding `/usr/bin` to the runner's PATH? Sometimes, even if `protoc` is installed, the build process may not have access to its location. You could also try explicitly calling the path to `protoc` in your build steps if that’s an option for you.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.