From f19d25e8a56fbf5bfe631953d07950969a1fba2f Mon Sep 17 00:00:00 2001 From: vickunwu <31735039+vickunwu@users.noreply.github.com> Date: Thu, 8 May 2025 14:26:37 +0800 Subject: [PATCH] Fix fdb amd64 build Failure (#1479) * Bump reproducible-containers/buildkit-cache-dance from 3.1.2 to 3.2.0 Bumps [reproducible-containers/buildkit-cache-dance](https://github.com/reproducible-containers/buildkit-cache-dance) from 3.1.2 to 3.2.0. - [Release notes](https://github.com/reproducible-containers/buildkit-cache-dance/releases) - [Commits](https://github.com/reproducible-containers/buildkit-cache-dance/compare/v3.1.2...v3.2.0) --- updated-dependencies: - dependency-name: reproducible-containers/buildkit-cache-dance dependency-version: 3.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Fix foundationdb-build fail on amd64 --------- Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- Dockerfile.build | 22 +++++++++++++++++++--- crates/store/Cargo.toml | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41d8c32e..81e69cff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -200,7 +200,7 @@ jobs: key: cargo-cache-${{ steps.cal-dep-shasum.outputs.checksum }} - name: Inject cache into docker - uses: reproducible-containers/buildkit-cache-dance@v3.1.2 + uses: reproducible-containers/buildkit-cache-dance@v3.2.0 with: cache-map: | { diff --git a/Dockerfile.build b/Dockerfile.build index 8785cda4..79e38f6e 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -60,13 +60,29 @@ RUN \ echo "Setting up ${BUILD_ENV}"; \ fi && \ if [[ "${TARGET}" == *gnu ]]; then \ - echo "export FDB_ARCH=${TARGET%%-*}" >> /env-cargo; \ + base_arch="${TARGET%%-*}"; \ + case "$base_arch" in \ + x86_64) \ + echo "export FDB_ARCH=amd64" >> /env-cargo; \ + ;; \ + aarch64) \ + echo "export FDB_ARCH=aarch64" >> /env-cargo; \ + ;; \ + *) \ + exit 1; \ + ;; \ + esac; \ fi # Install FoundationDB RUN \ source /env-cargo && \ if [ ! -z "${FDB_ARCH}" ]; then \ - curl --retry 5 -Lso /usr/lib/libfdb_c.so "$(curl --retry 5 -Ls 'https://api.github.com/repos/apple/foundationdb/releases' | jq --arg FDB_ARCH "$FDB_ARCH" -r '.[] | select(.prerelease == false) | .assets[] | select(.name | test("libfdb_c." + $FDB_ARCH + ".so")) | .browser_download_url' | head -n1)"; \ + curl --retry 5 -Lso fdb-client.deb "$(curl --retry 5 -Ls 'https://api.github.com/repos/apple/foundationdb/releases' | jq --arg FDB_ARCH "$FDB_ARCH" -r '.[] | select(.prerelease == false) | .assets[] | select(.name | test("foundationdb-clients.*" + $FDB_ARCH + ".deb$")) | .browser_download_url' | head -n1)" && \ + mkdir -p /fdb && \ + dpkg -x fdb-client.deb /fdb && \ + mv /fdb/usr/include/foundationdb /usr/include && \ + mv /fdb/usr/lib/libfdb_c.so /usr/lib && \ + rm -rf fdb-client.deb /fdb; \ fi # Cargo-chef Cache layer RUN \ @@ -98,7 +114,7 @@ RUN \ --mount=type=cache,target=/usr/local/cargo/git \ source /env-cargo && \ if [ ! -z "${FDB_ARCH}" ]; then \ - RUSTFLAGS="-L /usr/lib" cargo zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise"; \ + RUSTFLAGS="-L /usr/lib" cargo zigbuild --release --target ${TARGET} -p mail-server --no-default-features --features "foundationdb elastic s3 redis enterprise" && \ mv /app/target/${TARGET}/release/stalwart-mail /app/artifact/stalwart-mail-foundationdb; \ fi # Build generic version diff --git a/crates/store/Cargo.toml b/crates/store/Cargo.toml index d89d8da1..4e2dc351 100644 --- a/crates/store/Cargo.toml +++ b/crates/store/Cargo.toml @@ -9,7 +9,7 @@ utils = { path = "../utils" } nlp = { path = "../nlp" } trc = { path = "../trc" } rocksdb = { version = "0.23", optional = true, features = ["multi-threaded-cf"] } -foundationdb = { version = "0.9.2", features = ["embedded-fdb-include", "fdb-7_3"], optional = true } +foundationdb = { version = "0.9.2", features = ["fdb-7_3"], optional = true } rusqlite = { version = "0.32", features = ["bundled"], optional = true } rust-s3 = { version = "=0.35.0-alpha.2", default-features = false, features = ["tokio-rustls-tls", "no-verify-ssl"], optional = true } azure_core = { version = "0.21.0", optional = true }