From faa16bc143152aba57118a9a56c675474ad8c236 Mon Sep 17 00:00:00 2001 From: Joshua Oladele Date: Mon, 1 Jul 2024 14:24:27 +0100 Subject: [PATCH] fix: include target config for cargo's faulty linker --- .cargo/config.toml | 4 ++++ docker/fuel-core-nats.Dockerfile | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..c8a92b2 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +# This is needed to enable cross-platform docker builds, as cargo doesn't use the correct linker sometimes: +# https://github.com/rust-lang/cargo/issues/4133 +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" diff --git a/docker/fuel-core-nats.Dockerfile b/docker/fuel-core-nats.Dockerfile index 84c63ca..1477d36 100644 --- a/docker/fuel-core-nats.Dockerfile +++ b/docker/fuel-core-nats.Dockerfile @@ -5,9 +5,6 @@ FROM --platform=$BUILDPLATFORM rust:1.75.0 AS chef ARG TARGETPLATFORM RUN cargo install cargo-chef && rustup target add wasm32-unknown-unknown -# Add the target platform dynamically -RUN if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then rustup target add aarch64-unknown-linux-gnu; fi - WORKDIR /build/ COPY --from=xx / / @@ -23,13 +20,11 @@ RUN apt-get update && \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* - FROM chef as planner ENV CARGO_NET_GIT_FETCH_WITH_CLI=true COPY . . RUN cargo chef prepare --recipe-path recipe.json - FROM chef as builder ARG DEBUG_SYMBOLS=false ENV CARGO_NET_GIT_FETCH_WITH_CLI=true