Skip to content

Commit bda09e1

Browse files
Build libgccjit in CI
1 parent 0ac09b1 commit bda09e1

File tree

5 files changed

+64
-7
lines changed

5 files changed

+64
-7
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
cd $1
6+
7+
# Setting up folders for GCC
8+
git clone https://github.com/antoyo/gcc gcc-src
9+
cd gcc-src
10+
git checkout $(head -1 /scripts/libgccjit.version)
11+
12+
mkdir ../gcc-build ../gcc-install
13+
cd ../gcc-build
14+
15+
# Building GCC.
16+
../gcc-src/configure \
17+
--enable-host-shared \
18+
--enable-languages=jit \
19+
--enable-checking=release \
20+
--disable-bootstrap \
21+
--disable-multilib \
22+
--prefix=$(pwd)/../gcc-install
23+
make
24+
make install
25+
26+
rm -rf ../gcc-src
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cf9554126

src/ci/docker/host-x86_64/x86_64-gnu-llvm-16/Dockerfile

+12-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2424
xz-utils \
2525
nodejs \
2626
mingw-w64 \
27-
libgccjit-12-dev \
27+
# libgccjit dependencies
28+
flex \
29+
libmpfr-dev \
30+
libgmp-dev \
31+
libmpc3 \
32+
libmpc-dev \
2833
&& rm -rf /var/lib/apt/lists/*
2934

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

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

62+
COPY host-x86_64/dist-x86_64-linux/libgccjit.version /scripts/
63+
COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/
64+
65+
RUN sh /scripts/build-gccjit.sh /scripts
66+
RUN ln -s /scripts/gcc-install/lib/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so
67+
5768
ENV SCRIPT /tmp/script.sh

src/ci/docker/host-x86_64/x86_64-gnu-llvm-17/Dockerfile

+13-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2424
xz-utils \
2525
nodejs \
2626
mingw-w64 \
27-
libgccjit-13-dev \
27+
# libgccjit dependencies
28+
flex \
29+
libmpfr-dev \
30+
libgmp-dev \
31+
libmpc3 \
32+
libmpc-dev \
2833
&& rm -rf /var/lib/apt/lists/*
2934

30-
# Note: libgccjit needs to match the default gcc version for the linker to find it.
31-
3235
# Install powershell (universal package) so we can test x.ps1 on Linux
3336
RUN curl -sL "https://github.com/PowerShell/PowerShell/releases/download/v7.3.1/powershell_7.3.1-1.deb_amd64.deb" > powershell.deb && \
3437
dpkg -i powershell.deb && \
@@ -51,4 +54,11 @@ ENV RUST_CONFIGURE_ARGS \
5154

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

57+
58+
COPY host-x86_64/dist-x86_64-linux/libgccjit.version /scripts/
59+
COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/
60+
61+
RUN sh /scripts/build-gccjit.sh /scripts
62+
RUN ln -s /scripts/gcc-install/lib/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so
63+
5464
ENV SCRIPT /tmp/script.sh

src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile

+12-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
sudo \
1616
xz-utils \
1717
tidy \
18-
libgccjit-12-dev \
1918
\
2019
# Install dependencies for chromium browser
2120
gconf-service \
@@ -57,13 +56,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
5756
lsb-release \
5857
xdg-utils \
5958
wget \
59+
# libgccjit dependencies
60+
flex \
61+
libmpfr-dev \
62+
libgmp-dev \
63+
libmpc3 \
64+
libmpc-dev \
6065
&& rm -rf /var/lib/apt/lists/*
6166

6267
COPY scripts/sccache.sh /scripts/
6368
RUN sh /scripts/sccache.sh
6469

65-
# Make `libgccjit.so` accessible.
66-
RUN ln -s /usr/lib/gcc/x86_64-linux-gnu/12/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so
6770
# Fix rustc_codegen_gcc lto issues.
6871
ENV GCC_EXEC_PREFIX="/usr/lib/gcc/"
6972

@@ -92,6 +95,12 @@ ENV RUST_CONFIGURE_ARGS \
9295

9396
ENV HOST_TARGET x86_64-unknown-linux-gnu
9497

98+
COPY host-x86_64/dist-x86_64-linux/libgccjit.version /scripts/
99+
COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/
100+
101+
RUN sh /scripts/build-gccjit.sh /scripts
102+
RUN ln -s /scripts/gcc-install/lib/libgccjit.so /usr/lib/x86_64-linux-gnu/libgccjit.so
103+
95104
ENV SCRIPT /tmp/checktools.sh ../x.py && \
96105
NODE_PATH=`npm root -g` python3 ../x.py test tests/rustdoc-gui --stage 2 \
97106
--test-args "'--no-sandbox --jobs 1'"

0 commit comments

Comments
 (0)