golemcloud / golem

Golem is an open source durable computing platform that makes it easy to build and deploy highly reliable distributed systems.
https://learn.golem.cloud/
Apache License 2.0
258 stars 34 forks source link

building and installing golem-cli from source fails because of outdated protobuf syntax #841

Open revosw opened 1 month ago

revosw commented 1 month ago

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

1) Install build-essential, OpenSSL, protobuf compiler v3 and pkg-config

sudo apt install build-essential protobuf-compiler libssl-dev pkg-config

1) Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup install stable
rustup default stable

2) 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.
justcoon commented 1 month ago

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

revosw commented 1 month ago

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
vigoo commented 1 month ago

See also https://github.com/golemcloud/docs/issues/34