From 0016102a37856b72853aa1d22323b0a94743a48b Mon Sep 17 00:00:00 2001 From: mcbarton Date: Sun, 2 Feb 2025 10:02:31 +0000 Subject: [PATCH] Do not cross compile for Ubuntu arm target ci --- .github/workflows/main.yml | 24 ++++++--------------- ci/docker-build.sh | 16 +++----------- ci/docker/{Dockerfile.common => Dockerfile} | 15 +++++++------ ci/docker/Dockerfile.arm64-linux | 11 ---------- ci/docker/Dockerfile.x86_64-linux | 7 ------ 5 files changed, 19 insertions(+), 54 deletions(-) rename ci/docker/{Dockerfile.common => Dockerfile} (64%) delete mode 100644 ci/docker/Dockerfile.arm64-linux delete mode 100644 ci/docker/Dockerfile.x86_64-linux diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 28439f9..1371869 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,23 +26,7 @@ jobs: os: ubuntu-24.04 - artifact: arm64-linux - os: ubuntu-24.04 - rust_target: aarch64-unknown-linux-gnu - env: - # Don't build a sysroot for this cross-compiled target since it - # would require a host compiler and the sysroot is otherwise - # already built on other CI builders. - WASI_SDK_CI_SKIP_SYSROOT: 1 - - WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS: >- - -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc - -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ - -DCMAKE_CROSSCOMPILING=True - -DCMAKE_CXX_FLAGS=-march=armv8-a - -DCMAKE_SYSTEM_PROCESSOR=arm64 - -DCMAKE_SYSTEM_NAME=Linux - -DLLVM_HOST_TRIPLE=aarch64-linux-gnu - -DRUST_TARGET=aarch64-unknown-linux-gnu + os: ubuntu-24.04-arm - artifact: arm64-macos os: macos-14 @@ -89,6 +73,12 @@ jobs: mkdir -p '${{ runner.tool_cache }}/ccache' echo 'CCACHE_DIR=${{ runner.tool_cache }}/ccache' >> $GITHUB_ENV shell: bash + # Remove and reinstall rust as default install seems broken on Ubuntu arm + - run: rm -rf $HOME/.rustup $HOME/.cargo + if: matrix.os == 'ubuntu-24.04-arm' + + - uses: actions-rust-lang/setup-rust-toolchain@v1 + if: matrix.os == 'ubuntu-24.04-arm' # Configure CMake flags for `ci/build.sh` as necessary for each # matrix entry. diff --git a/ci/docker-build.sh b/ci/docker-build.sh index b5b8498..7773f79 100755 --- a/ci/docker-build.sh +++ b/ci/docker-build.sh @@ -1,8 +1,7 @@ #!/bin/sh # This is a helper script invoked from CI which will execute the `ci/build.sh` -# script within a docker container. This builds `ci/docker/Dockerfile.common` -# along with the specified `ci/docker/Dockerfile.$x` from the command line. +# script within a docker container. This contain is built using the Dockerfile located at `ci/docker/Dockerfile` # This container is then used to execute `ci/build.sh`. set -e @@ -16,17 +15,8 @@ fi set -x -# Build the base image which the image below can used. -docker build \ - --file ci/docker/Dockerfile.common \ - --tag wasi-sdk-builder-base \ - ci/docker - -# Build the container that is going to be used -docker build \ - --file ci/docker/Dockerfile.$1 \ - --tag wasi-sdk-builder \ - ci/docker +# Build the Docker imager +docker build --tag wasi-sdk-builder ci/docker # Perform the build in `/src`. The current directory is mounted read-write at # this location as well. To ensure that container-created files are reasonable diff --git a/ci/docker/Dockerfile.common b/ci/docker/Dockerfile similarity index 64% rename from ci/docker/Dockerfile.common rename to ci/docker/Dockerfile index 96013b7..9188fc2 100644 --- a/ci/docker/Dockerfile.common +++ b/ci/docker/Dockerfile @@ -19,17 +19,20 @@ RUN apt-get update \ # Install a more recent version of CMake than what 18.04 has since that's what # LLVM requires. -RUN curl -sSLO https://github.com/Kitware/CMake/releases/download/v3.29.5/cmake-3.29.5-linux-x86_64.tar.gz \ - && tar xf cmake-3.29.5-linux-x86_64.tar.gz \ - && rm cmake-3.29.5-linux-x86_64.tar.gz \ +RUN ARCH=$(uname -m) \ + && curl -sSLO https://github.com/Kitware/CMake/releases/download/v3.29.5/cmake-3.29.5-linux-${ARCH}.tar.gz \ + && tar xf cmake-3.29.5-linux-${ARCH}.tar.gz \ + && rm cmake-3.29.5-linux-${ARCH}.tar.gz \ && mkdir -p /opt \ - && mv cmake-3.29.5-linux-x86_64 /opt/cmake + && mv cmake-3.29.5-linux-${ARCH} /opt/cmake ENV PATH /opt/cmake/bin:$PATH # As with CMake install a later version of Ninja than waht 18.04 has. -RUN curl -sSLO https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip \ - && unzip ninja-linux.zip \ +RUN ARCH=$(uname -m) \ + && if [ "$ARCH" = "aarch64" ]; then SUFFIX=-aarch64; fi \ + && curl -sSL -o ninja.zip https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux${SUFFIX}.zip \ + && unzip ninja.zip \ && rm *.zip \ && mv ninja /opt/cmake/bin diff --git a/ci/docker/Dockerfile.arm64-linux b/ci/docker/Dockerfile.arm64-linux deleted file mode 100644 index 6be6d6e..0000000 --- a/ci/docker/Dockerfile.arm64-linux +++ /dev/null @@ -1,11 +0,0 @@ -FROM wasi-sdk-builder-base - -# Install an extra C++ toolchain which can target arm64 linux. -RUN apt-get install -y g++-aarch64-linux-gnu - -# Configure Rust to use this new compiler for linking Rust executables. -ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER aarch64-linux-gnu-gcc - -# Note that `.github/workflows/main.yml` sets various bits and bobs of -# configuration and cmake flags that may get passed to the underlying build. For -# example LLVM is instructed to use the toolchain installed above. diff --git a/ci/docker/Dockerfile.x86_64-linux b/ci/docker/Dockerfile.x86_64-linux deleted file mode 100644 index 9d443e5..0000000 --- a/ci/docker/Dockerfile.x86_64-linux +++ /dev/null @@ -1,7 +0,0 @@ -FROM wasi-sdk-builder-base - -# No extra configuration necessary for x86_64 over what `Dockerfile.common` -# already has. -# -# Note though that `.github/workflows/main.yml` still sets various bits and bobs -# of configuration and cmake flags that may get passed to the underlying build.