platform icon indicating copy to clipboard operation
platform copied to clipboard

`v1.0-dev` (the current working branch) fails to build from source

Open coolaj86 opened this issue 1 year ago • 4 comments

v1.0-dev fails to build from source

This part of the error may be particularly important:

This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.

Related: https://github.com/dashpay/platform/issues/1535

Expected Behavior

The latest commit on the main working branch should correctly reference working versions of dependencies and build without issues.

Current Behavior

Compiling predicates-tree v1.0.9
error: failed to run custom build command for `tenderdash-proto v0.14.0-dev.6 (https://github.com/dashpay/rs-tenderdash-abci#8b5afe6b)`

Caused by:
  process didn't exit successfully: `/home/app/dash-drive/target/debug/build/tenderdash-proto-d79eced1ac4d88fb/build-script-build` (exit status: 101)
  --- stdout
  [info] => Fetching https://github.com/dashpay/tenderdash at v0.14.0-dev.2 into "/home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/../target/tenderdash"
    [info] => Downloading and extracting https://github.com/dashpay/tenderdash/archive/v0.14.0-dev.2.zip into /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/../target/tenderdash
      [info] => Download and extract tenderdash sources, attempt 1/2
        [info] => Downloading https://github.com/dashpay/tenderdash/archive/v0.14.0-dev.2.zip
        [info] => Extracting downloaded archive /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/../target/tenderdash-v0.14.0-dev.2.zip
        [info] => Extracted tenderdash sources to /tmp/.tmpa0Ikms
  [info] => Determining ABCI protocol version.
  [info] => Creating structs.

  --- stderr
  thread 'main' panicked at /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/src/lib.rs:100:55:
  called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: tendermint/abci/types.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.\n" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `tenderdash-proto v0.14.0-dev.6 (https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.6#701ba0fa)`

Caused by:
  process didn't exit successfully: `/home/app/dash-drive/target/debug/build/tenderdash-proto-69deebc203305415/build-script-build` (exit status: 101)
  --- stdout
  [info] => Fetching https://github.com/dashpay/tenderdash at v0.14.0-dev.2 into "/home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/../target/tenderdash"
    [info] => Downloading and extracting https://github.com/dashpay/tenderdash/archive/v0.14.0-dev.2.zip into /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/../target/tenderdash
      [info] => Download and extract tenderdash sources, attempt 1/2
        [info] => Downloading https://github.com/dashpay/tenderdash/archive/v0.14.0-dev.2.zip
        [info] => Extracting downloaded archive /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/../target/tenderdash-v0.14.0-dev.2.zip
        [info] => Extracted tenderdash sources to /tmp/.tmp1gLOdt
  [info] => Determining ABCI protocol version.
  [info] => Creating structs.

  --- stderr
  thread 'main' panicked at /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/src/lib.rs:100:55:
  called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: tendermint/abci/types.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.\n" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Building [======================>  ] 510/554: librocksdb-sys(build)

Possible Solution

Not sure.

I suspect that the either the generated protobuf file was not committed (and is not being generated during the build), or the dependency is linked to the wrong verison.

Steps to Reproduce (for bugs)

Taken from https://github.com/dashpay/platform/issues/1696

  1. Install Build Dependencies
    sudo apt update
    sudo apt install -y \
        build-essential \
        clang \
        cmake
    sudo apt install -y \
        protobuf-compiler
    curl https://webi.sh/rust | sh
    source ~/.config/envman/PATH.env
    
  2. Clone Source (latest commit only)
    IMPORTANT
    Check https://github.com/dashpay/platform to see whether it's actually master or something else, like v1.0-dev, that's the current working "main" branch.
    git clone --depth 1 --single-branch --branch 'v1.0-dev' \
        https://github.com/dashpay/platform.git \
        ./dash-drive/
    
  3. Build from Source \
    pushd ./dash-drive/packages/rs-drive-abci/
    
    cargo build
    ls -lAhF ../target/debug/drive-abci
    
    cargo build --release
    ls -lAhF ../target/release/drive-abci
    
    popd
    

Context

Just trying to build the binaries in the simplest way possible (fewest layers of abstraction, most direct from source on a Linux system).

Your Environment

cat /etc/issue
Ubuntu 22.04 LTS \n \l
uname -srm
Linux 5.15.131-2-pve x86_64

coolaj86 avatar Feb 23 '24 03:02 coolaj86

It looks like rerunning the build gives a different, perhaps more informative set of errors:

error: failed to run custom build command for `dapi-grpc v1.0.0-dev.5 (/home/app/dash-drive_v1.0-dev_2024-02-22/packages/dapi-grpc)`

Caused by:
  process didn't exit successfully: `/home/app/dash-drive_v1.0-dev_2024-02-22/target/debug/build/dapi-grpc-3c70640056dd9fe0/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=/home/app/dash-drive/packages/dapi-grpc/protos/core/v0/core.proto
  cargo:rerun-if-changed=/home/app/dash-drive/packages/dapi-grpc/protos

  --- stderr
  thread 'main' panicked at packages/dapi-grpc/build.rs:15:10:
  generate core proto: Custom { kind: Other, error: "protoc failed: Could not make proto path relative: /home/app/dash-drive/packages/dapi-grpc/protos/core/v0/core.proto: No such file or directory\n" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `tenderdash-proto v0.14.0-dev.6 (https://github.com/dashpay/rs-tenderdash-abci#8b5afe6b)`

Caused by:
  process didn't exit successfully: `/home/app/dash-drive_v1.0-dev_2024-02-22/target/debug/build/tenderdash-proto-d79eced1ac4d88fb/build-script-build` (exit status: 101)
  --- stdout
  [info] => Fetching https://github.com/dashpay/tenderdash at v0.14.0-dev.2 into "/home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/../target/tenderdash"
    [info] => Downloading and extracting https://github.com/dashpay/tenderdash/archive/v0.14.0-dev.2.zip into /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/../target/tenderdash
      [info] => Download and extract tenderdash sources, attempt 1/2
        [info] => Archive file /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/../target/tenderdash-v0.14.0-dev.2.zip already exists, skipping download
        [info] => Extracting downloaded archive /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/../target/tenderdash-v0.14.0-dev.2.zip
        [info] => Extracted tenderdash sources to /tmp/.tmpfVJZvs
  [info] => Determining ABCI protocol version.
  [info] => Creating structs.

  --- stderr
  thread 'main' panicked at /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/8b5afe6/proto-compiler/src/lib.rs:100:55:
  called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: tendermint/abci/types.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.\n" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to run custom build command for `tenderdash-proto v0.14.0-dev.6 (https://github.com/dashpay/rs-tenderdash-abci?tag=v0.14.0-dev.6#701ba0fa)`

Caused by:
  process didn't exit successfully: `/home/app/dash-drive_v1.0-dev_2024-02-22/target/debug/build/tenderdash-proto-69deebc203305415/build-script-build` (exit status: 101)
  --- stdout
  [info] => Fetching https://github.com/dashpay/tenderdash at v0.14.0-dev.2 into "/home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/../target/tenderdash"
    [info] => Downloading and extracting https://github.com/dashpay/tenderdash/archive/v0.14.0-dev.2.zip into /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/../target/tenderdash
      [info] => Download and extract tenderdash sources, attempt 1/2
        [info] => Archive file /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/../target/tenderdash-v0.14.0-dev.2.zip already exists, skipping download
        [info] => Extracting downloaded archive /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/../target/tenderdash-v0.14.0-dev.2.zip
        [info] => Extracted tenderdash sources to /tmp/.tmpqBhy0Q
  [info] => Determining ABCI protocol version.
  [info] => Creating structs.

  --- stderr
  thread 'main' panicked at /home/app/.cargo/git/checkouts/rs-tenderdash-abci-3da7e285d64883ec/701ba0f/proto-compiler/src/lib.rs:100:55:
  called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: tendermint/abci/types.proto: This file contains proto3 optional fields, but --experimental_allow_proto3_optional was not set.\n" }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

coolaj86 avatar Feb 23 '24 03:02 coolaj86

Reading your comments at https://github.com/dashpay/platform/issues/1696, have you been able to accomplish to build drive after all? It seems there are no issues for me:

pshenmic@Mikhails-MacBook-Pro rs-drive-abci % cargo build                        
warning: `drive-abci` (lib) generated 72 warnings (run `cargo fix --lib -p drive-abci` to apply 58 suggestions)
    Finished dev [unoptimized + debuginfo] target(s) in 3m 12s
pshenmic@Mikhails-MacBook-Pro rs-drive-abci % ls -lAhF ../../target/debug/drive-abci
-rwxr-xr-x  1 pshenmic  staff   113M Feb 23 13:34 ../../target/debug/drive-abci*
pshenmic@Mikhails-MacBook-Pro rs-drive-abci % ../../target/debug/drive-abci --version
drive-abci 1.0.0-dev.5

But probably I may have different versions of the toolsets

pshenmic avatar Feb 23 '24 10:02 pshenmic

@pshenmic Yeah. We'll need to add specific versions for protoc and llvm to the docs because LTS is out of date and doesn't work.

I'm not sure what the minimum versions are, but the current latest on GitHub Releases work:

  • protoc v25.3
    protoc --version
    
    libprotoc 25.3
    
  • clang v17.0.6
    clang --version
    
    clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /home/app/.local/opt/clang+llvm/bin
    

coolaj86 avatar Feb 23 '24 23:02 coolaj86

We already have a version for protoc in README.md. llvm in ubuntu 22 works for me.

shumkov avatar Sep 23 '24 15:09 shumkov