building and installing golem-cli from source fails because of outdated protobuf syntax
Trying to build golem-cli through cargo install as described in the quickstart.
cargo install --features universal golem-cloud-cli
Since I am on ubuntu, I had to do these prerequisites: 0) Update apt repositories
sudo apt update
- Install build-essential, OpenSSL, protobuf compiler v3 and pkg-config
sudo apt install build-essential protobuf-compiler libssl-dev pkg-config
- Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup install stable
rustup default stable
- Run cargo install to compile golem-cli
cargo install --features universal golem-cloud-cli
cargo install fails on this step:
error: failed to run custom build command for `golem-wasm-ast v1.0.0`
Caused by:
process didn't exit successfully: `/tmp/cargo-installyHmf5B/release/build/golem-wasm-ast-9b02091be0cf5add/build-script-build` (exit status: 1)
--- stderr
Error: Custom { kind: Other, error: "protoc failed: wasm/ast/type.proto:49:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.\nwasm/ast/type.proto:50:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.\nwasm/ast/type.proto:69:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.\n" }
warning: build failed, waiting for other jobs to finish...
error: failed to compile `golem-cloud-cli v1.0.5`, intermediate artifacts can be found at `/tmp/cargo-installyHmf5B`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
hello @revosw, which version of protobuf-compiler do you have?
optional in proto3: https://protobuf.dev/programming-guides/field_presence/#how-to-enable-explicit-presence-in-proto3
if you have such error, probably you have older version of protoc compiler
I found a discrepancy between Ubuntu 20.04 and Ubuntu 24.04.
For Ubuntu 20.04, the latest version I can install through apt install protobuf-compiler is version 3.6.1
hackathon@User:~$ protoc --version
libprotoc 3.6.1
For Ubuntu 24.04, the latest version I can install through apt install protobuf-compiler is version 3.21.12
hackathon@User:~$ protoc --version
libprotoc 3.21.12
See also https://github.com/golemcloud/docs/issues/34
Closed in favor of #744