Skip to content

Commit

Permalink
Build libgccjit in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Mar 3, 2024
1 parent 7151f60 commit 6c43bce
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 7 deletions.
26 changes: 26 additions & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/build-gccjit.sh
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cf9554126
13 changes: 12 additions & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
xz-utils \
nodejs \
mingw-w64 \
libgccjit-12-dev \
# libgccjit dependencies
flex \
libmpfr-dev \
libgmp-dev \
libmpc3 \
libmpc-dev \
&& rm -rf /var/lib/apt/lists/*

# Note: libgccjit needs to match the default gcc version for the linker to find it.
Expand Down Expand Up @@ -54,4 +59,10 @@ ENV RUST_CONFIGURE_ARGS \

COPY host-x86_64/x86_64-gnu-llvm-16/script.sh /tmp/

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/script.sh
16 changes: 13 additions & 3 deletions src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
xz-utils \
nodejs \
mingw-w64 \
libgccjit-13-dev \
# libgccjit dependencies
flex \
libmpfr-dev \
libgmp-dev \
libmpc3 \
libmpc-dev \
&& rm -rf /var/lib/apt/lists/*

# Note: libgccjit needs to match the default gcc version for the linker to find it.

# Install powershell (universal package) so we can test x.ps1 on Linux
RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/powershell_7.3.1-1.deb_amd64.deb" > powershell.deb && \
dpkg -i powershell.deb && \
Expand All @@ -51,4 +54,11 @@ ENV RUST_CONFIGURE_ARGS \

COPY host-x86_64/x86_64-gnu-llvm-16/script.sh /tmp/


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/script.sh
15 changes: 12 additions & 3 deletions src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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/"

Expand Down Expand Up @@ -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'"

0 comments on commit 6c43bce

Please sign in to comment.