diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh new file mode 100644 index 0000000000000..58026ec70ef8c --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +set -ex + +cd $1 + +# Setting up folders for GCC +git clone https://github.com/antoyo/gcc gcc-src +cd gcc-src +git checkout $(head -1 /scripts/libgccjit.version) + +mkdir ../gcc-build ../gcc-install +cd ../gcc-build + +# Building GCC. +../gcc-src/configure \ + --enable-host-shared \ + --enable-languages=jit \ + --enable-checking=release \ + --disable-bootstrap \ + --disable-multilib \ + --prefix=$(pwd)/../gcc-install +make +make install + +rm -rf ../gcc-src diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/libgccjit.version b/src/ci/docker/host-x86_64/dist-x86_64-linux/libgccjit.version new file mode 100644 index 0000000000000..ad2c3b12b874a --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/libgccjit.version @@ -0,0 +1 @@ +cf9554126 diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile index f4850715e82e8..04e5c80de67c5 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile @@ -24,7 +24,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xz-utils \ nodejs \ mingw-w64 \ - libgccjit-12-dev \ && rm -rf /var/lib/apt/lists/* # Note: libgccjit needs to match the default gcc version for the linker to find it. diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile index fe30a95344104..81bb9629fd0ed 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile @@ -24,7 +24,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xz-utils \ nodejs \ mingw-w64 \ - libgccjit-13-dev \ && rm -rf /var/lib/apt/lists/* # Note: libgccjit needs to match the default gcc version for the linker to find it. diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 82385ea15b7ca..276a84388f425 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ sudo \ xz-utils \ tidy \ - libgccjit-12-dev \ \ # Install dependencies for chromium browser gconf-service \ @@ -57,13 +56,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ lsb-release \ xdg-utils \ wget \ + # libgccjit dependencies + flex \ + libmpfr-dev \ + libgmp-dev \ + libmpc3 \ + libmpc-dev \ && rm -rf /var/lib/apt/lists/* COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -# Make `libgccjit.so` accessible. -RUN ln -s /usr/lib/gcc/x86_64-linux-gnu/12/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so # Fix rustc_codegen_gcc lto issues. ENV GCC_EXEC_PREFIX="/usr/lib/gcc/" @@ -92,6 +95,12 @@ ENV RUST_CONFIGURE_ARGS \ ENV HOST_TARGET x86_64-unknown-linux-gnu +COPY host-x86_64/dist-x86_64-linux/libgccjit.version /scripts/ +COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ + +RUN sh /scripts/build-gccjit.sh /scripts +RUN ln -s /scripts/gcc-install/lib/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so + ENV SCRIPT /tmp/checktools.sh ../x.py && \ NODE_PATH=`npm root -g` python3 ../x.py test tests/rustdoc-gui --stage 2 \ --test-args "'--no-sandbox --jobs 1'"