From a34ed42f95e1a15b005f62e99f3d6b5c160b6d0d Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Thu, 29 Feb 2024 08:32:09 +0530 Subject: [PATCH 1/2] set CROSS_SYSROOT=/ to fix cross-rs openssl issue Signed-off-by: Rajat Jindal --- cross/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cross/Dockerfile b/cross/Dockerfile index 18840f1434..9790d2718e 100644 --- a/cross/Dockerfile +++ b/cross/Dockerfile @@ -1,5 +1,10 @@ FROM ghcr.io/cross-rs/aarch64-unknown-linux-musl@sha256:7ad32efcae37c178fed63da301ff982d2430f15fc7d39e6c0b28124e14fac394 +## as per analysis done in https://github.com/fermyon/spin/pull/2287#issuecomment-1970145410 we need +## to disable the cmake config in cross-rs. Setting CROSS_SYSROOT=/ seems to have done the trick + +ENV CROSS_SYSROOT=/ + RUN --mount=type=bind,source=/,target=/polyfill /polyfill/polyfill.sh From 7db46851e1f049b8374dcd372ed6d090d6e61768 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Thu, 29 Feb 2024 08:41:43 +0530 Subject: [PATCH 2/2] use rust flags from cargo config instead of ci overrides Signed-off-by: Rajat Jindal --- .cargo/config | 6 ++++++ .github/workflows/build.yml | 7 ++----- .github/workflows/release.yml | 7 ++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.cargo/config b/.cargo/config index 313670ddb8..c390ab08e0 100644 --- a/.cargo/config +++ b/.cargo/config @@ -3,3 +3,9 @@ [target.aarch64-unknown-linux-gnu] rustflags = ["-C", "target-feature=+fp16"] + +[target.aarch64-unknown-linux-musl] + rustflags = ["-C", "target-feature=+fp16", "-C", "target-feature=+crt-static", "-C", "link-self-contained=yes"] + +[target.x86_64-unknown-linux-musl] + rustflags = ["-C", "target-feature=+crt-static", "-C", "link-self-contained=yes"] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12d59aed55..49f3fbae60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,13 +81,11 @@ jobs: config: - { arch: "aarch64", - target: "aarch64-unknown-linux-musl", - rustflags: '-C target-feature=+fp16 -C target-feature=+crt-static -C link-self-contained=yes' + target: "aarch64-unknown-linux-musl" } - { arch: "amd64", - target: "x86_64-unknown-linux-musl", - rustflags: '-C target-feature=+crt-static -C link-self-contained=yes' + target: "x86_64-unknown-linux-musl" } steps: - uses: actions/checkout@v3 @@ -104,7 +102,6 @@ jobs: env: CARGO_INCREMENTAL: 0 BUILD_SPIN_EXAMPLES: 0 - RUSTFLAGS: ${{ matrix.config.rustflags }} - name: "Archive executable artifact" uses: actions/upload-artifact@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a29cb4151..da71fbcb39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -290,13 +290,11 @@ jobs: config: - { arch: "aarch64", - target: "aarch64-unknown-linux-musl", - rustflags: '-C target-feature=+fp16 -C target-feature=+crt-static -C link-self-contained=yes' + target: "aarch64-unknown-linux-musl" } - { arch: "amd64", - target: "x86_64-unknown-linux-musl", - rustflags: '-C target-feature=+crt-static -C link-self-contained=yes' + target: "x86_64-unknown-linux-musl" } steps: - uses: actions/checkout@v3 @@ -335,7 +333,6 @@ jobs: env: CARGO_INCREMENTAL: 0 BUILD_SPIN_EXAMPLES: 0 - RUSTFLAGS: ${{ matrix.config.rustflags }} - name: Install Cosign for signing Spin binary uses: sigstore/cosign-installer@v3.0.1