buck2 icon indicating copy to clipboard operation
buck2 copied to clipboard

Can't build via documented `cargo` commands

Open philipcraig opened this issue 3 years ago • 2 comments

With Ubuntu 20.04.5 LTS and rustup, cargo, protoc installed and on path, building via cargo with the supplied command:

cargo build --bin=buck2 --release

eventually gives error text of:

error: failed to run custom build command for `buck2_data v0.1.0 (/home/philip/work/buck2/buck2_data)`

Caused by:
  process didn't exit successfully: `/home/philip/work/buck2/target/release/build/buck2_data-aee8f8c0a5c9a583/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=PROTOC
  cargo:rerun-if-env-changed=PROTOC_INCLUDE
  cargo:rerun-if-env-changed=OUT_DIR
  cargo:rerun-if-changed=data.proto
  cargo:rerun-if-changed=data.proto
  cargo:rerun-if-changed=.

  --- stderr
  INFO: Not setting $PROTOC to "../../../third-party/protobuf/dotslash/protoc", as path does not exist
  INFO: Not setting $PROTOC_INCLUDE to "../../../third-party/protobuf/protobuf/src", as path does not exist
  Error: Custom { kind: Other, error: "protoc failed: Unknown flag: --experimental_allow_proto3_optional\n" }
warning: build failed, waiting for other jobs to finish...

philipcraig avatar Dec 04 '22 17:12 philipcraig

You need protoc 3.6 or higher. What does protoc --version say?

ndmitchell avatar Dec 04 '22 18:12 ndmitchell

i see the same thing.

root@2ef690c32f0c:buck2# apt-get install protobuf-compiler
Reading package lists... Done
Building dependency tree       
Reading state information... Done
protobuf-compiler is already the newest version (3.6.1.3-2ubuntu5).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

root@2ef690c32f0c:buck2# protoc --version
libprotoc 3.6.1

also Ubuntu 20.04.5 LTS.

shayne-fletcher avatar Dec 05 '22 02:12 shayne-fletcher

I think its 3.12 where this was introduced, actually. Can you try with https://github.com/protocolbuffers/protobuf/releases/download/v21.10/protoc-21.10-linux-x86_64.zip

ndmitchell avatar Dec 05 '22 21:12 ndmitchell

@stepancheg is going to look at moving us to https://crates.io/crates/protoc-bin-vendored, which will mean we don't need to install protoc at all.

ndmitchell avatar Dec 05 '22 22:12 ndmitchell

I think its 3.12 where this was introduced, actually. Can you try with https://github.com/protocolbuffers/protobuf/releases/download/v21.10/protoc-21.10-linux-x86_64.zip

that works. successful build with protoc 3.21.10.

shayne-fletcher avatar Dec 06 '22 00:12 shayne-fletcher

Confirmed, successful with the 3.21.10 binary.

philipcraig avatar Dec 06 '22 09:12 philipcraig