diff --git a/scripts/Docker/_clang-cross-common.sh b/scripts/Docker/_clang-cross-common.sh index cad0b6c535..14fda6a5b3 100755 --- a/scripts/Docker/_clang-cross-common.sh +++ b/scripts/Docker/_clang-cross-common.sh @@ -15,11 +15,11 @@ DOCKER_DIR="$1" # the target architecture to build for ARCH="$2" -# the docker image architecture to use +# the docker platform to use MACHINE_ARCH="$(uname -m)" case $MACHINE_ARCH in - arm64) IMAGE_ARCH=arm64v8 ; MACHINE_ARCH=aarch64 ;; - *) IMAGE_ARCH=amd64 ;; + arm64) PLATFORM=linux/arm64 ; MACHINE_ARCH=aarch64 ;; + *) PLATFORM=linux/amd64 ;; esac # the ABI @@ -28,10 +28,16 @@ ABI=$3 # the variant VARIANT=$4 +# architecture-specific additional args (matching CI configuration) +ADDITIONAL_ARGS="" +case $ARCH in + loongarch64) ADDITIONAL_ARGS="--verifyGlibcMax=2.38" ;; +esac + (cd $DIR && docker build --tag skiasharp-linux-$ABI-cross-$ARCH \ + --platform=$PLATFORM \ --build-arg BUILD_ARCH=$ARCH \ - --build-arg IMAGE_ARCH=$IMAGE_ARCH \ --build-arg MACHINE_ARCH=$MACHINE_ARCH \ $DOCKER_DIR) @@ -40,4 +46,4 @@ VARIANT=$4 (cd $DIR/../.. && docker run --rm --name skiasharp-linux-$ABI-cross-$ARCH --volume $(pwd):/work skiasharp-linux-$ABI-cross-$ARCH /bin/bash -c " \ dotnet tool restore ; \ - dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH $VARIANT ") + dotnet cake --target=externals-linux-clang-cross --configuration=Release --buildarch=$ARCH $VARIANT $ADDITIONAL_ARGS ") diff --git a/scripts/Docker/alpine/clang-cross/Dockerfile b/scripts/Docker/alpine/clang-cross/Dockerfile index 07ea41ef7f..97f26f560c 100644 --- a/scripts/Docker/alpine/clang-cross/Dockerfile +++ b/scripts/Docker/alpine/clang-cross/Dockerfile @@ -1,11 +1,10 @@ # Arguments: -# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 | loongarch64 ] # DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] # LLVM_VERSION - the version of the LLVM compiler [ 19 | * ] # TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-alpine-linux-musleabihf | aarch64-alpine-linux-musl | riscv64-alpine-linux-musl | loongarch64-alpine-linux-musl ] -ARG IMAGE_ARCH=amd64 -FROM ${IMAGE_ARCH}/debian:12 +# Use --platform flag when building to select architecture +FROM debian:12 # Set the architecture-specific variables based on the value of the BUILD_ARCH argument ARG BUILD_ARCH=arm64 diff --git a/scripts/Docker/debian/clang-cross/10/Dockerfile b/scripts/Docker/debian/clang-cross/10/Dockerfile index 679fc96365..0c41081b90 100644 --- a/scripts/Docker/debian/clang-cross/10/Dockerfile +++ b/scripts/Docker/debian/clang-cross/10/Dockerfile @@ -1,13 +1,12 @@ # Arguments: -# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 ] # DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] # LLVM_VERSION - the version of the LLVM compiler [ 13 | * ] # TOOLCHAIN_VERSION - the version of the GCC toolchain [ 8 | * ] # TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu ] # TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 ] -ARG IMAGE_ARCH=amd64 -FROM ${IMAGE_ARCH}/debian:10 +# Use --platform flag when building to select architecture +FROM debian:10 # Switch to archives RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list && \ diff --git a/scripts/Docker/debian/clang-cross/11/Dockerfile b/scripts/Docker/debian/clang-cross/11/Dockerfile index 785ac6fea0..7cc822da11 100644 --- a/scripts/Docker/debian/clang-cross/11/Dockerfile +++ b/scripts/Docker/debian/clang-cross/11/Dockerfile @@ -1,13 +1,12 @@ # Arguments: -# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 ] # DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] # LLVM_VERSION - the version of the LLVM compiler [ 19 | * ] # TOOLCHAIN_VERSION - the version of the GCC toolchain [ 12 | * ] # TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu ] # TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 ] -ARG IMAGE_ARCH=amd64 -FROM ${IMAGE_ARCH}/debian:11 +# Use --platform flag when building to select architecture +FROM debian:11 # Set the architecture-specific variables based on the value of the BUILD_ARCH argument ARG BUILD_ARCH=arm64 diff --git a/scripts/Docker/debian/clang-cross/12/Dockerfile b/scripts/Docker/debian/clang-cross/12/Dockerfile index 7d30c8ab60..cbdcd5f045 100644 --- a/scripts/Docker/debian/clang-cross/12/Dockerfile +++ b/scripts/Docker/debian/clang-cross/12/Dockerfile @@ -1,13 +1,12 @@ # Arguments: -# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 ] # DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] # LLVM_VERSION - the version of the LLVM compiler [ 19 | * ] # TOOLCHAIN_VERSION - the version of the GCC toolchain [ 12 | * ] # TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu ] # TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 ] -ARG IMAGE_ARCH=amd64 -FROM ${IMAGE_ARCH}/debian:12 +# Use --platform flag when building to select architecture +FROM debian:12 # Set the architecture-specific variables based on the value of the BUILD_ARCH argument ARG BUILD_ARCH=arm64 diff --git a/scripts/Docker/debian/clang-cross/13/Dockerfile b/scripts/Docker/debian/clang-cross/13/Dockerfile index fbf2d9234e..f6a62cb139 100644 --- a/scripts/Docker/debian/clang-cross/13/Dockerfile +++ b/scripts/Docker/debian/clang-cross/13/Dockerfile @@ -1,13 +1,12 @@ # Arguments: -# IMAGE_ARCH - the architecture of the image [ amd64 | arm64v8 | riscv64 | loongarch64 ] # DOTNET_SDK_VERSION - the version of dotnet for the Cake script [ 8.0 | * ] # LLVM_VERSION - the version of the LLVM compiler [ 19 | * ] # TOOLCHAIN_VERSION - the version of the GCC toolchain [ 14 | * ] # TOOLCHAIN_ARCH - the architecture of the GCC toolchain [ arm-linux-gnueabihf | aarch64-linux-gnu | riscv64-linux-gnu | loongarch64-linux-gnu ] # TOOLCHAIN_ARCH_SHORT - the short form architecture of the GCC toolchain [ armhf | arm64 | riscv64 | loong64 ] -ARG IMAGE_ARCH=amd64 -FROM ${IMAGE_ARCH}/debian:13 +# Use --platform flag when building to select architecture +FROM debian:13 # Set the architecture-specific variables based on the value of the BUILD_ARCH argument ARG BUILD_ARCH=arm64 @@ -51,12 +50,11 @@ RUN . /etc/skia-env \ && sed -i "s/\/usr\/${TOOLCHAIN_ARCH}\/lib\///g" /usr/${TOOLCHAIN_ARCH}/lib/libc.so # Install the cross-compilation skia build dependencies (fontconfig) -# In order to compat Loongnix 25, LoongArch APT_REPO use loongnix 25 mirrors. RUN . /etc/skia-env \ && mkdir -p /skia-utils/libfontconfig-dev \ && cd /skia-utils/libfontconfig-dev \ && case "${TOOLCHAIN_ARCH_SHORT}" in \ - loong64) FC_VERSION=2.15.0-1.1 ; FC_PKG=libfontconfig-dev ; APT_REPO=https://pkg.loongnix.cn/loongnix/25 ;; \ + loong64) FC_VERSION=2.17.1-3 ; FC_PKG=libfontconfig-dev ; APT_REPO=http://deb.debian.org/debian ;; \ riscv64) FC_VERSION=2.15.0-2.3 ; FC_PKG=libfontconfig-dev ; APT_REPO=http://deb.debian.org/debian ;; \ *) FC_VERSION=2.13.1-2 ; FC_PKG=libfontconfig1-dev ; APT_REPO=http://deb.debian.org/debian ;; \ esac \ diff --git a/scripts/azure-templates-jobs-bootstrapper.yml b/scripts/azure-templates-jobs-bootstrapper.yml index d5c8f7e425..3b597b752e 100644 --- a/scripts/azure-templates-jobs-bootstrapper.yml +++ b/scripts/azure-templates-jobs-bootstrapper.yml @@ -352,7 +352,7 @@ jobs: dockerfile: ${{ parameters.docker }}/Dockerfile context: ${{ parameters.docker }} image: skiasharp:skiasharp - buildArguments: --tag skiasharp ${{ parameters.dockerArgs }} + buildArguments: --platform linux/amd64 --tag skiasharp ${{ parameters.dockerArgs }} enableNetwork: true - ${{ if ne(parameters.use1ESPipelineTemplates, 'true') }}: - task: Docker@2 @@ -367,7 +367,7 @@ jobs: command: build buildContext: ${{ parameters.docker }} dockerfile: ${{ parameters.docker }}/Dockerfile - arguments: --tag skiasharp ${{ parameters.dockerArgs }} + arguments: --platform linux/amd64 --tag skiasharp ${{ parameters.dockerArgs }} - bash: | echo dotnet tool restore > cmd.sh echo dotnet cake --target=${{ parameters.target }} --verbosity=${{ parameters.verbosity }} --configuration=${{ coalesce(parameters.configuration, 'Release') }} ${{ parameters.additionalArgs }} >> cmd.sh