AstarNetwork / Astar

The dApp hub for blockchains of the future
https://astar.network/
GNU General Public License v3.0
735 stars 326 forks source link

Docker build failed for v5.42.2 evm-tracing node #1311

Closed wafeishushu closed 1 month ago

wafeishushu commented 1 month ago

when i try to build docker image for astar, i ran into build failed issue. version: 5.42.2

Dockerfile:

FROM rust:1.77.2-slim as rust-builder

RUN apt-get update -y && \
    apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev protobuf-compiler && \
    apt-get clean && \
    rm -r /var/lib/apt/lists/*

RUN rustup default stable && rustup target add wasm32-unknown-unknown && rustup show

RUN mkdir /data
WORKDIR /data

FROM rust-builder as builder-astar-bin

WORKDIR /data

COPY . .
RUN cargo build --release --features evm-tracing

Error Message:

....
17.4      Compiling sp-block-builder v26.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185)
617.4   warning: unused import: `TransactionV0 as LegacyTransaction`
617.4     --> /data/vendor/primitives/debug/src/lib.rs:19:16
617.4      |
617.4   19 | use ethereum::{TransactionV0 as LegacyTransaction, TransactionV2 as Transaction};
617.4      |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
617.4      |
617.4      = note: `#[warn(unused_imports)]` on by default
617.4
617.4      Compiling frame-system-rpc-runtime-api v26.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185)
617.4   warning: `moonbeam-rpc-primitives-debug` (lib) generated 2 warnings (1 duplicate) (run `cargo fix --lib -p moonbeam-rpc-primitives-debug` to apply 1 suggestion)
617.4      Compiling sp-offchain v26.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185)
617.4      Compiling sp-transaction-pool v26.0.0 (https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.9.0#5641e185)
617.4   warning: `moonbeam-rpc-primitives-txpool` (lib) generated 1 warning (1 duplicate)
617.4   error[E0152]: duplicate lang item in crate `std` (which `memchr` depends on): `panic_impl`.
617.4     |
617.4     = note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
617.4     = note: first definition in `sp_io` loaded from /data/target/release/wbuild/shiden-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-e18f6a7c6c611e52.rmeta
617.4     = note: second definition in `std` loaded from /data/target/release/wbuild/shiden-runtime/target/wasm32-unknown-unknown/release/deps/libstd-5bee3122d2095be0.rmeta
617.4
617.4   For more information about this error, try `rustc --explain E0152`.
617.4   error: could not compile `frame-support` (lib) due to 1 previous error
------
Dockerfile:18
--------------------
  16 |
  17 |     COPY . .
  18 | >>> RUN cargo build --release --features evm-tracing
  19 |
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo build --release --features evm-tracing" did not complete successfully: exit code: 101

it seems a redefine issue.

Dinonard commented 1 month ago

It must be a problem with your docker setup, the evm tracing build works fine, I just tried it out.

The tracing binary was also build as part of the release without any problems.

wafeishushu commented 1 month ago

@Dinonard thanks for your reply.

Did you build it successfully with ubuntu? did I miss some dependencies?

Dinonard commented 1 month ago

No, I've built it on mac. CI machinery built it on ubuntu (link).

I'm not sure what the issue could be with your build. We don't use rust:1.77.2-slim so it might be also related to that.

ermalkaleci commented 1 month ago

you may need rust-src component

Dinonard commented 1 month ago

If rustup show is run inside the root of the repo, it should install all necessary components though.

But good idea to check!

ermalkaleci commented 1 month ago

If rustup show is run inside the root of the repo, it should install all necessary components though.

But good idea to check!

It's not. It's run on rust-builder

wafeishushu commented 1 month ago

Perhaps I have found the problem. You guys updated Cargo.lock this time, but inside .dockerignore, the file Cargo.lock was ignored and not passed to the container. If you don't have Cargo.lock inside the container, executing cargo build --release --features evm-tracing will download different dependencies.