iroh icon indicating copy to clipboard operation
iroh copied to clipboard

Need to pass an argument **--experimental_allow_proto3_option** for iroh-p2p compilation on Linux machine.

Open Strange21 opened this issue 3 years ago • 1 comments

We tried to compile the module iroh-p2p on linux machine, Following are the errors we faced and there solution:

  1. The dependency over protocol buffers: Need to install the Protocol buffer compiler.
  2. After installing the protocol buffer version 3.12.4, we need to pass an argument --experimental_allow_proto3_option to the protocol buffer compiler.
  3. Therefore need to add config.protoc_arg("--experimental_allow_proto3_optional"); in iroh-ipc-types/build.rs file.

Since the documentation is under progress, we would like to know if there is a chat channel available to discuss such problems? Do you have a

  • Discord channel group?
  • Element.io group?
  • or some other specific channel.

Strange21 avatar Aug 29 '22 03:08 Strange21

Hey, we're still super early stage so many of the finer bits are lacking. Docs are in progress and I hope we have them up soon. Still working out the comms channels tho.

As for the specific issue you're having, can you upgrade protoc to 3.20+, the issue should go away.

Arqu avatar Aug 29 '22 08:08 Arqu

Hey, We have upgraded the version of Protoc to 3.20+. Still getting following error while compiling iroh-share on linux virtual machine with kernel version 5.15.0.47

 Compiling if-watch v1.1.1
   Compiling hyper v0.14.20
   Compiling opentelemetry-otlp v0.10.0
error: failed to run custom build command for `iroh-rpc-types v0.1.0 (/home/udayakumar/testdevspace/iroh/iroh-rpc-types)`



Caused by:
  process didn't exit successfully: `/home/udayakumar/testdevspace/iroh/target/release/build/iroh-rpc-types-6ec7eb5597c02fbf/build-script-build` (exit status: 101)
  --- stdout
  Running: "/usr/local/bin/protoc" "--include_imports" "--include_source_info" "-o" "/tmp/prost-buildQDEMUb/prost-descriptor-set" "-I" "proto" "proto/p2p.proto" "proto/store.proto" "proto/gateway.proto" "proto/test.proto"



 --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: google/protobuf/empty.proto: File not found.\np2p.proto:5:1: Import \"google/protobuf/empty.proto\" was not found or had errors.\np2p.proto:8:15: \"google.protobuf.Empty\" is not defined.\np2p.proto:11:25: \"google.protobuf.Empty\" is not defined.\np2p.proto:12:16: \"google.protobuf.Empty\" is not defined.\np2p.proto:14:50: \"google.protobuf.Empty\" is not defined.\np2p.proto:15:16: \"google.protobuf.Empty\" is not defined.\np2p.proto:15:48: \"google.protobuf.Empty\" is not defined.\np2p.proto:17:61: \"google.protobuf.Empty\" is not defined.\np2p.proto:18:29: \"google.protobuf.Empty\" is not defined.\np2p.proto:19:25: \"google.protobuf.Empty\" is not defined.\np2p.proto:22:64: \"google.protobuf.Empty\" is not defined.\np2p.proto:24:23: \"google.protobuf.Empty\" is not defined.\n" }', iroh-rpc-types/build.rs:23:56
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Is there specific thing that we are missing? protoc version we are using in

udayakumar@udayakumar-VirtualBox:~$ protoc --version
libprotoc 3.21.5

Strange21 avatar Sep 05 '22 11:09 Strange21

Missing the "default" protobuf empty.proto usually means that you only updated the protoc binary but not the support files that come with it.

fabricedesre avatar Sep 05 '22 15:09 fabricedesre

It might be that your protoc is not referenced correctly. Here's the snippet from CI that makes things work, you probably need to export your PROTOC and PROTOC_INCLUDE paths for it to pick up.

PROTOC_VERSION=3.20.1
PROTOC_ZIP=protoc-$PROTOC_VERSION-<<parameters.os>>-<<parameters.arch>>.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
export PROTOC=/usr/local/bin/protoc
export PROTOC_INCLUDE=/usr/local/include

Arqu avatar Sep 07 '22 09:09 Arqu