From 0524327ba39004e43a5479dbfa4736ef41b7a23e Mon Sep 17 00:00:00 2001 From: Kuba_Z2 <77853483+KubaZ2@users.noreply.github.com> Date: Sat, 30 Nov 2024 16:36:23 +0100 Subject: [PATCH] Try to fix building of .net 9 (#6) --- .github/workflows/dotnet.yml | 12 +----------- Backend/Sandbox/CheckedJit/Dockerfile | 10 ++++++---- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f478d9e..5bf8dc2 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -53,9 +53,6 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -79,13 +76,7 @@ jobs: - 'Backend/Sandbox/CheckedJit/**' - '.github/workflows/**' - - name: Set MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64 - if: steps.checked-jit.outputs.checked-jit == 'true' - run: | - MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64=${{ runner.arch != 'X64' && format('-{0}', runner.arch) || '' }} - echo "MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64=${MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64,,}" >>${GITHUB_ENV} - - - name: Build and push runtime with checked jit + - name: Build and push checked jit if: steps.checked-jit.outputs.checked-jit == 'true' uses: docker/bake-action@v5 with: @@ -96,7 +87,6 @@ jobs: *.platform=linux/amd64,linux/arm64 *.cache-from=type=gha *.cache-to=type=gha,mode=min - checked-jit.args.MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64=${{ env.MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64 }} - name: Build and push backend uses: docker/bake-action@v5 diff --git a/Backend/Sandbox/CheckedJit/Dockerfile b/Backend/Sandbox/CheckedJit/Dockerfile index 40e93a0..c7134e9 100644 --- a/Backend/Sandbox/CheckedJit/Dockerfile +++ b/Backend/Sandbox/CheckedJit/Dockerfile @@ -2,15 +2,16 @@ ARG DOTNET_RUNTIME_VERSION=9.0.0 ARG OS=ubuntu ARG OS_VERSION=24.04 ARG OS_CODENAME=noble -ARG MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64 -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet-buildtools/prereqs:$OS-$OS_VERSION$MINUS_PREFIXED_PLATFORM_IF_NOT_AMD64 AS build-env +FROM --platform=$BUILDPLATFORM $OS:$OS_CODENAME AS build-env WORKDIR /runtime ARG DOTNET_RUNTIME_VERSION ARG OS_CODENAME ARG TARGETARCH ARG BUILDARCH +RUN apt update -y && apt install -y git + RUN git clone --depth 1 --branch v$DOTNET_RUNTIME_VERSION https://github.com/dotnet/runtime.git . # Asserts fail when running in pwn.red/jail, so we need to remove them @@ -27,9 +28,10 @@ RUN if [ $TARGETARCH = $BUILDARCH ]; then \ x86) BINUTILS_ARCH=i686 DOTNET_ARCH=x86 ;; \ *) echo "Unsupported target architecture: $TARGETARCH" && exit 1 ;; \ esac && \ - sudo apt update -y && sudo apt install -y qemu-user-static binfmt-support debootstrap binutils-$BINUTILS_ARCH-linux-gnu && \ ln -s /usr/bin/llvm-objcopy-14 /usr/bin/llvm-objcopy && \ - sudo ./eng/common/cross/build-rootfs.sh $DOTNET_ARCH $OS_CODENAME && \ + apt install -y debootstrap lld && \ + ./eng/install-native-dependencies.sh && \ + ./eng/common/cross/build-rootfs.sh $DOTNET_ARCH $OS_CODENAME && \ ROOTFS_DIR=/runtime/.tools/rootfs/$DOTNET_ARCH ./build.sh clr -c Checked -a $DOTNET_ARCH --cross; \ fi