From bc2ebcadc0eb695605051c9d362c3f5dc184c63c Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 25 Oct 2022 20:28:09 +0100 Subject: [PATCH] Everywhere: Require version >= 12 for GCC host compiler So far we've gotten away with using GCC 11 for Lagom and to compile the toolchain, but via #15795 we discovered a compiler bug that has been fixed in the latest version but would error the build with CI's GCC 11. Time for an upgrade :^) We already use ubuntu-22.04 images in most places, so this is pretty straightforward. The only exception is Idan's self-hosted runner, which uses Ubuntu Focal. LibJS should build fine with GCC 11, still. --- .github/workflows/cmake.yml | 12 ++++++------ .github/workflows/pvs-studio-static-analysis.yml | 8 ++++---- .github/workflows/sonar-cloud-static-analysis.yml | 8 ++++---- Documentation/BuildInstructions.md | 13 +++++-------- Documentation/SelfHostedRunners.md | 11 +++++------ Documentation/Troubleshooting.md | 4 ++-- Meta/Azure/Lagom.yml | 4 ++-- Meta/Azure/Serenity.yml | 4 ++-- Meta/Azure/Setup.yml | 10 +++++----- Meta/serenity.sh | 4 ++-- Toolchain/Dockerfile | 6 +++--- 11 files changed, 40 insertions(+), 44 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 8b8e0af859d..74e411e8038 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -47,7 +47,7 @@ jobs: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' sudo apt-get update - sudo apt-get install -y clang-format-14 ccache e2fsprogs gcc-11 g++-11 libstdc++-11-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip + sudo apt-get install -y clang-format-14 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build optipng qemu-utils qemu-system-i386 unzip - name: Install JS dependencies run: sudo npm install -g prettier@2.7.1 - name: Install Python dependencies @@ -56,7 +56,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 requests - name: Check versions - run: set +e; g++ --version; g++-11 --version; clang-format --version; clang-format-14 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version + run: set +e; g++ --version; g++-12 --version; clang-format --version; clang-format-14 --version; prettier --version; python --version; python3 --version; ninja --version; flake8 --version; ccache --version; qemu-system-i386 --version # === PREPARE FOR BUILDING === @@ -147,8 +147,8 @@ jobs: -DSERENITY_ARCH=${{ matrix.arch }} \ -DSERENITY_TOOLCHAIN=GNU \ -DBUILD_LAGOM=ON \ - -DCMAKE_C_COMPILER=gcc-11 \ - -DCMAKE_CXX_COMPILER=g++-11 \ + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 \ -DENABLE_ALL_DEBUG_FACILITIES=ON \ -DENABLE_PCI_IDS_DOWNLOAD=OFF \ -DENABLE_USB_IDS_DOWNLOAD=OFF @@ -161,8 +161,8 @@ jobs: cmake -S Meta/CMake/Superbuild -B Build/superbuild -GNinja \ -DSERENITY_ARCH=${{ matrix.arch }} \ -DSERENITY_TOOLCHAIN=GNU \ - -DCMAKE_C_COMPILER=gcc-11 \ - -DCMAKE_CXX_COMPILER=g++-11 \ + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 \ -DENABLE_UNDEFINED_SANITIZER=ON \ -DDUMP_REGIONS_ON_CRASH=ON \ -DENABLE_PCI_IDS_DOWNLOAD=OFF \ diff --git a/.github/workflows/pvs-studio-static-analysis.yml b/.github/workflows/pvs-studio-static-analysis.yml index 6eef54734b9..59793b0b6a7 100644 --- a/.github/workflows/pvs-studio-static-analysis.yml +++ b/.github/workflows/pvs-studio-static-analysis.yml @@ -28,10 +28,10 @@ jobs: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' sudo apt-get update - sudo apt-get install -y clang-format-14 gcc-11 g++-11 libstdc++-11-dev libmpfr-dev libmpc-dev ninja-build unzip pvs-studio + sudo apt-get install -y clang-format-14 gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build unzip pvs-studio - name: Check versions - run: set +e; g++ --version; g++-11 --version; ninja --version; + run: set +e; g++ --version; g++-12 --version; ninja --version; - name: Prepare useful stamps id: stamps @@ -73,8 +73,8 @@ jobs: cmake -S Meta/CMake/Superbuild -B Build/superbuild -GNinja \ -DSERENITY_ARCH=${{ env.PVS_STUDIO_ANALYSIS_ARCH }} \ -DSERENITY_TOOLCHAIN=GNU \ - -DCMAKE_C_COMPILER=gcc-11 \ - -DCMAKE_CXX_COMPILER=g++-11 \ + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 \ -DENABLE_PCI_IDS_DOWNLOAD=OFF \ -DENABLE_USB_IDS_DOWNLOAD=OFF diff --git a/.github/workflows/sonar-cloud-static-analysis.yml b/.github/workflows/sonar-cloud-static-analysis.yml index 647b57bb334..61c033e0ff8 100644 --- a/.github/workflows/sonar-cloud-static-analysis.yml +++ b/.github/workflows/sonar-cloud-static-analysis.yml @@ -61,10 +61,10 @@ jobs: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' sudo apt-get update - sudo apt-get install -y clang-format-14 gcc-11 g++-11 libstdc++-11-dev libmpfr-dev libmpc-dev ninja-build unzip + sudo apt-get install -y clang-format-14 gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build unzip - name: Check versions - run: set +e; g++ --version; g++-11 --version; ninja --version; + run: set +e; g++ --version; g++-12 --version; ninja --version; - name: Prepare useful stamps id: stamps @@ -106,8 +106,8 @@ jobs: cmake -S Meta/CMake/Superbuild -B Build/superbuild -GNinja \ -DSERENITY_ARCH=${{ env.SONAR_ANALYSIS_ARCH }} \ -DSERENITY_TOOLCHAIN=GNU \ - -DCMAKE_C_COMPILER=gcc-11 \ - -DCMAKE_CXX_COMPILER=g++-11 \ + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 \ -DENABLE_PCI_IDS_DOWNLOAD=OFF \ -DENABLE_USB_IDS_DOWNLOAD=OFF diff --git a/Documentation/BuildInstructions.md b/Documentation/BuildInstructions.md index 9885b0d4049..8fd2bed0749 100644 --- a/Documentation/BuildInstructions.md +++ b/Documentation/BuildInstructions.md @@ -11,13 +11,10 @@ sudo apt install build-essential cmake curl libmpfr-dev libmpc-dev libgmp-dev e2 ``` Optional: `fuse2fs` for [building images without root](https://github.com/SerenityOS/serenity/pull/11224). -#### GCC 11 +#### GCC 12 -On Ubuntu gcc-11 is available in the repositories of 21.04 (Hirsuite) and later - add the `ubuntu-toolchain-r/test` PPA if you're running an older version: - -```console -sudo add-apt-repository ppa:ubuntu-toolchain-r/test -``` +On Ubuntu gcc-12 is available in the repositories of 22.04 (Jammy) and later. +If you are running an older version, you will either need to upgrade, or find an alternative installation source. Next, update your local package information from this repository: @@ -25,10 +22,10 @@ Next, update your local package information from this repository: sudo apt update ``` -Now on Ubuntu or Debian you can install gcc-11 with apt like this: +Now on Ubuntu or Debian you can install gcc-12 with apt like this: ```console -sudo apt install gcc-11 g++-11 +sudo apt install gcc-12 g++-12 ``` #### QEMU 6.2 or later diff --git a/Documentation/SelfHostedRunners.md b/Documentation/SelfHostedRunners.md index 5cfccba16f4..fb99c251c4e 100644 --- a/Documentation/SelfHostedRunners.md +++ b/Documentation/SelfHostedRunners.md @@ -14,20 +14,19 @@ As for recommended requirements, listed below are the specifications of the curr ## Setup -These instructions assume the OS installed is Ubuntu 20.04 (Focal), so they might not be compatible with other Linux flavours. +These instructions assume the OS installed is Ubuntu 22.04 (Jammy), so they might not be compatible with other Linux flavours. ### Install base dependencies ```shell sudo add-apt-repository ppa:canonical-server/server-backports -sudo add-apt-repository ppa:ubuntu-toolchain-r/test wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - -sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' +sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-focal-14 main' apt update -apt install git build-essential make cmake clang-format-14 gcc-11 g++-11 libstdc++-11-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt +apt install git build-essential make cmake clang-format-14 gcc-12 g++-12 libstdc++-12-dev libgmp-dev ccache libmpfr-dev libmpc-dev ninja-build e2fsprogs qemu-utils qemu-system-i386 wabt ``` -### Force usage of GCC 11 +### Force usage of GCC 12 ```shell -update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 +update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 ``` ### Create a new user account named 'runner' ```shell diff --git a/Documentation/Troubleshooting.md b/Documentation/Troubleshooting.md index 4b41a949548..b5a3752b627 100644 --- a/Documentation/Troubleshooting.md +++ b/Documentation/Troubleshooting.md @@ -16,9 +16,9 @@ install it. You can also build it using the `Toolchain/BuildQemu.sh` script. ### GCC is missing or is outdated -Ensure your gcc version is >= 11 with `gcc --version`. Otherwise, install it. If your gcc binary is not +Ensure your gcc version is >= 12 with `gcc --version`. Otherwise, install it. If your gcc binary is not called `gcc` you have to specify the names of your C and C++ compiler when you run cmake, e.g. -`cmake ../.. -GNinja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11`. +`cmake ../.. -GNinja -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_CXX_COMPILER=g++-12`. ## Running SerenityOS diff --git a/Meta/Azure/Lagom.yml b/Meta/Azure/Lagom.yml index 253b146d4c6..41c394fa1b5 100644 --- a/Meta/Azure/Lagom.yml +++ b/Meta/Azure/Lagom.yml @@ -102,8 +102,8 @@ jobs: -DWASM_SPEC_TEST_SKIP_FORMATTING=ON \ -DENABLE_UNDEFINED_SANITIZER=ON \ -DENABLE_ADDRESS_SANITIZER=ON \ - -DCMAKE_C_COMPILER=gcc-11 \ - -DCMAKE_CXX_COMPILER=g++-11 + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 displayName: 'Create Build Environment' workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom env: diff --git a/Meta/Azure/Serenity.yml b/Meta/Azure/Serenity.yml index 65aa7d927b0..0d75f001f04 100644 --- a/Meta/Azure/Serenity.yml +++ b/Meta/Azure/Serenity.yml @@ -50,8 +50,8 @@ jobs: -DDUMP_REGIONS_ON_CRASH=ON \ -DENABLE_PCI_IDS_DOWNLOAD=OFF \ -DENABLE_USB_IDS_DOWNLOAD=OFF \ - -DCMAKE_C_COMPILER=gcc-11 \ - -DCMAKE_CXX_COMPILER=g++-11 + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 displayName: 'Create Build Environment' workingDirectory: $(Build.SourcesDirectory) env: diff --git a/Meta/Azure/Setup.yml b/Meta/Azure/Setup.yml index 53d12d4354b..21aaf77d240 100644 --- a/Meta/Azure/Setup.yml +++ b/Meta/Azure/Setup.yml @@ -10,21 +10,21 @@ steps: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' sudo apt-get update - sudo apt-get install clang-format-14 ccache e2fsprogs gcc-11 g++-11 libstdc++-11-dev libmpfr-dev libmpc-dev ninja-build qemu-utils qemu-system-i386 unzip lld + sudo apt-get install clang-format-14 ccache e2fsprogs gcc-12 g++-12 libstdc++-12-dev libmpfr-dev libmpc-dev ninja-build qemu-utils qemu-system-i386 unzip lld displayName: 'Install Dependencies' - ${{ if eq(parameters.os, 'Linux') }}: - script: | - sudo apt-get purge -y clang-11 clang-12 gcc-10 + sudo apt-get purge -y clang-12 gcc-10 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-13 main' sudo apt-get update - sudo apt-get install ccache gcc-11 g++-11 clang-13 libstdc++-11-dev ninja-build unzip + sudo apt-get install ccache gcc-12 g++-12 clang-13 libstdc++-12-dev ninja-build unzip sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-13 100 sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-13 100 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 wget https://github.com/WebAssembly/wabt/releases/download/1.0.23/wabt-1.0.23-ubuntu.tar.gz tar -xzf ./wabt-1.0.23-ubuntu.tar.gz diff --git a/Meta/serenity.sh b/Meta/serenity.sh index ed171e55b20..63ce4cbfcde 100755 --- a/Meta/serenity.sh +++ b/Meta/serenity.sh @@ -192,7 +192,7 @@ pick_host_compiler() { return fi - find_newest_compiler egcc gcc gcc-11 gcc-12 /usr/local/bin/gcc-11 /opt/homebrew/bin/gcc-11 + find_newest_compiler egcc gcc gcc-12 /usr/local/bin/gcc-12 /opt/homebrew/bin/gcc-12 if is_supported_compiler "$HOST_COMPILER"; then export CC="${HOST_COMPILER}" export CXX="${HOST_COMPILER/gcc/g++}" @@ -206,7 +206,7 @@ pick_host_compiler() { return fi - die "Please make sure that GCC version 11, Clang version 13, or higher is installed." + die "Please make sure that GCC version 12, Clang version 13, or higher is installed." } cmd_with_target() { diff --git a/Toolchain/Dockerfile b/Toolchain/Dockerfile index cb64d63ff33..a8af4f36d69 100644 --- a/Toolchain/Dockerfile +++ b/Toolchain/Dockerfile @@ -8,8 +8,8 @@ RUN apt-get update -y \ ccache \ cmake \ curl \ - g++-11 \ - gcc-11 \ + g++-12 \ + gcc-12 \ e2fsprogs \ genext2fs \ git \ @@ -29,4 +29,4 @@ RUN apt-get update -y \ tzdata \ unzip \ && rm -rf /var/lib/apt/lists/ \ - && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 900 --slave /usr/bin/g++ g++ /usr/bin/g++-11 + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 900 --slave /usr/bin/g++ g++ /usr/bin/g++-12