From 24e10892b08eac594e2389800a1f53bd4d3453ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Fri, 11 Oct 2024 19:46:15 +0200 Subject: [PATCH] Set `ucrt` as default runtime library --- .github/scripts/config.ps1 | 2 +- .github/scripts/config.sh | 2 +- .github/workflows/advanced.yml | 22 +++++++++---------- .../workflows/build-and-test-toolchain.yml | 4 ++-- .github/workflows/test-toolchain.yml | 2 +- README.md | 4 ++-- tests/CMakeLists.txt | 6 ++++- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/scripts/config.ps1 b/.github/scripts/config.ps1 index 8bf1e8c63..5b72a7cdf 100644 --- a/.github/scripts/config.ps1 +++ b/.github/scripts/config.ps1 @@ -2,7 +2,7 @@ Set-PSDebug -Trace 2 # echo on if ( -not $env:ARCH ) { $env:ARCH = "aarch64" } if ( -not $env:PLATFORM ) { $env:PLATFORM = "w64-mingw32" } -if ( -not $env:CRT ) { $env:CRT = "msvcrt" } +if ( -not $env:CRT ) { $env:CRT = "ucrt" } if ( -not $env:TARGET ) { $env:TARGET = "$env:ARCH-$env:PLATFORM" } if ( -not $env:TOOLCHAIN_NAME ) { $env:TOOLCHAIN_NAME = "$env:ARCH-$env:PLATFORM-$env:CRT" } diff --git a/.github/scripts/config.sh b/.github/scripts/config.sh index 1ae7735e3..c02e82527 100644 --- a/.github/scripts/config.sh +++ b/.github/scripts/config.sh @@ -14,7 +14,7 @@ COCOM_BRANCH=${COCOM_BRANCH:-master} ARCH=${ARCH:-aarch64} PLATFORM=${PLATFORM:-w64-mingw32} if [[ "$PLATFORM" =~ (mingw|cygwin) ]]; then - CRT=${CRT:-msvcrt} + CRT=${CRT:-ucrt} else CRT=${CRT:-libc} fi diff --git a/.github/workflows/advanced.yml b/.github/workflows/advanced.yml index ed29ab610..870e479bd 100644 --- a/.github/workflows/advanced.yml +++ b/.github/workflows/advanced.yml @@ -102,15 +102,15 @@ env: ARCH: aarch64 PLATFORM: w64-mingw32 - CRT: msvcrt + CRT: ucrt TOOLCHAIN_PATH: ${{ github.workspace }}/cross - TOOLCHAIN_NAME: aarch64-w64-mingw32-msvcrt - TOOLCHAIN_ARTIFACT_NAME: aarch64-w64-mingw32-msvcrt-toolchain - TOOLCHAIN_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-toolchain.tar.gz - RUNTIME_ARTIFACT_NAME: aarch64-w64-mingw32-msvcrt-toolchain - RUNTIME_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-runtime.tar.gz - TESTS_ARTIFACT_NAME: aarch64-w64-mingw32-msvcrt-tests - TESTS_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-tests.tar.gz + TOOLCHAIN_NAME: aarch64-w64-mingw32-ucrt + TOOLCHAIN_ARTIFACT_NAME: aarch64-w64-mingw32-ucrt-toolchain + TOOLCHAIN_PACKAGE_NAME: aarch64-w64-mingw32-ucrt-toolchain.tar.gz + RUNTIME_ARTIFACT_NAME: aarch64-w64-mingw32-ucrt-toolchain + RUNTIME_PACKAGE_NAME: aarch64-w64-mingw32-ucrt-runtime.tar.gz + TESTS_ARTIFACT_NAME: aarch64-w64-mingw32-ucrt-tests + TESTS_PACKAGE_NAME: aarch64-w64-mingw32-ucrt-tests.tar.gz SOURCE_PATH: ${{ github.workspace }}/code BUILD_PATH: ${{ github.workspace }}/build @@ -149,7 +149,7 @@ jobs: ARCH: ${{ matrix.arch }} PLATFORM: ${{ matrix.platform }} CRT: ${{ matrix.crt }} - PACK_TOOLCHAIN: ${{ matrix.arch == 'aarch64' && matrix.platform == 'w64-mingw32' && matrix.crt == 'msvcrt' }} + PACK_TOOLCHAIN: ${{ matrix.arch == 'aarch64' && matrix.platform == 'w64-mingw32' && matrix.crt == 'ucrt' }} TOOLCHAIN_NAME: ${{ matrix.arch }}-${{ matrix.platform }}-${{ matrix.crt }} TOOLCHAIN_ARTIFACT_NAME: ${{ matrix.arch }}-${{ matrix.platform }}-${{ matrix.crt }}-toolchain TOOLCHAIN_PACKAGE_NAME: ${{ matrix.arch }}-${{ matrix.platform }}-${{ matrix.crt }}-toolchain.tar.gz @@ -386,7 +386,7 @@ jobs: runs-on: ubuntu-latest env: - TESTS_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-tests.tar.gz + TESTS_PACKAGE_NAME: aarch64-w64-mingw32-ucrt-tests.tar.gz steps: - name: Checkout repository @@ -429,7 +429,7 @@ jobs: runs-on: [Windows, GCC, ARM64] env: - TESTS_PACKAGE_NAME: aarch64-w64-mingw32-msvcrt-tests.tar.gz + TESTS_PACKAGE_NAME: aarch64-w64-mingw32-ucrt-tests.tar.gz steps: - name: Checkout repository diff --git a/.github/workflows/build-and-test-toolchain.yml b/.github/workflows/build-and-test-toolchain.yml index 547e306eb..67b67f555 100644 --- a/.github/workflows/build-and-test-toolchain.yml +++ b/.github/workflows/build-and-test-toolchain.yml @@ -26,7 +26,7 @@ on: crt: description: 'C runtime to build for' required: false - default: 'msvcrt' + default: 'ucrt' tag: description: 'Tag to use for the artifact' required: true @@ -66,7 +66,7 @@ env: ARCH: ${{ inputs.arch || 'x86_64' }} PLATFORM: ${{ inputs.platform || 'w64-mingw32' }} - CRT: ${{ inputs.crt || 'msvcrt' }} + CRT: ${{ inputs.crt || 'ucrt' }} TAG: ${{ inputs.tag || 'test' }} MODULE: ${{ inputs.gcc_module || '' }} diff --git a/.github/workflows/test-toolchain.yml b/.github/workflows/test-toolchain.yml index 044265f2a..0d86f2c6a 100644 --- a/.github/workflows/test-toolchain.yml +++ b/.github/workflows/test-toolchain.yml @@ -38,7 +38,7 @@ on: crt: description: 'C runtime to build for' required: false - default: 'msvcrt' + default: 'ucrt' workflow_call: inputs: binutils_branch_baseline: diff --git a/README.md b/README.md index e91f40b68..4f58ce8f8 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ which is the default. To see what will be installed refer to # Building the Cross-Compiler -To build the cross-compiler and install it into a `~/cross-aarch64-w64-mingw32-msvcrt` folder, +To build the cross-compiler and install it into a `~/cross-aarch64-w64-mingw32-ucrt` folder, follow these steps: 1. Clone the repository: @@ -69,7 +69,7 @@ The build script does multiple things: After building the toolchain, to build a simple C source code file run: ```bash -export PATH="~/cross-aarch64-w64-mingw32-msvcrt/bin:$PATH" +export PATH="~/cross-aarch64-w64-mingw32-ucrt/bin:$PATH" aarch64-w64-mingw32-gcc hello.c -o hello.exe ``` diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 116d5649c..13e67c73d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,14 +3,18 @@ set(CMAKE_VERBOSE_MAKEFILE ON) if (NOT DEFINED ENV{TARGET}) set(ENV{TARGET} "aarch64-w64-mingw32") endif() +if (NOT DEFINED ENV{CRT}) + set(ENV{CRT} "ucrt") +endif() if (NOT DEFINED ENV{TOOLCHAIN_NAME}) - set(ENV{TOOLCHAIN_NAME} "$ENV{TARGET}-msvcrt") + set(ENV{TOOLCHAIN_NAME} "$ENV{TARGET}-$ENV{CRT}") endif() if (NOT DEFINED ENV{TOOLCHAIN_PATH}) set(ENV{TOOLCHAIN_PATH} "$ENV{HOME}/cross-$ENV{TOOLCHAIN_NAME}") endif() set(CMAKE_C_COMPILER "$ENV{TOOLCHAIN_PATH}/bin/$ENV{TARGET}-gcc") +set(CMAKE_CXX_COMPILER "$ENV{TOOLCHAIN_PATH}/bin/$ENV{TARGET}-g++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fopenmp") set(CMAKE_RANLIB "$ENV{TOOLCHAIN_PATH}/bin/$ENV{TARGET}-ranlib")