Skip to content

Commit 70cbd75

Browse files
authored
[libc] Add all the toolchains needed for libc-shared-tests to the docker container. (#197735)
Toolchains include: - gcc-7, 8, 9, 11 - qemu-static-user - cross-build toolchain for aarch64, riscv64, ppc64le, including gcc, g++, gmp, mpfr, mpc. Container size before the change: ~ 500 MB Container size after the change: ~ 1.3 - 1.4 GB
1 parent 3f420c9 commit 70cbd75

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/containers/libc/Dockerfile

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,32 @@ RUN apt-get update && \
88
libgmp-dev \
99
libmpc-dev \
1010
ninja-build \
11+
build-essential \
12+
gcc-9 \
13+
g++-9 \
14+
gcc-11 \
15+
g++-11 \
16+
qemu-user-static \
17+
libc6-dev-arm64-cross \
18+
libstdc++6-arm64-cross \
19+
gcc-aarch64-linux-gnu \
20+
g++-aarch64-linux-gnu \
21+
libc6-dev-riscv64-cross \
22+
libstdc++6-riscv64-cross \
23+
gcc-riscv64-linux-gnu \
24+
g++-riscv64-linux-gnu \
25+
libc6-dev-ppc64el-cross \
26+
libstdc++6-ppc64el-cross \
27+
gcc-powerpc64le-linux-gnu \
28+
g++-powerpc64le-linux-gnu \
1129
sudo \
1230
sccache \
1331
wget \
1432
lsb-release \
1533
software-properties-common \
1634
gnupg \
1735
cmake \
36+
m4 \
1837
linux-libc-dev && \
1938
apt-get clean && \
2039
rm -rf /var/lib/apt/lists/*
@@ -23,6 +42,75 @@ RUN wget https://apt.llvm.org/llvm.sh && \
2342
chmod +x llvm.sh && \
2443
sudo ./llvm.sh 23 && \
2544
rm llvm.sh
45+
46+
# Install gmp and mpfr for cross compilation
47+
RUN wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz && \
48+
tar -xf gmp-6.3.0.tar.xz && \
49+
cd gmp-6.3.0 && \
50+
./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu && \
51+
make -j8 && \
52+
sudo make install && \
53+
cd .. && \
54+
rm -rf gmp-6.3.0 && \
55+
rm gmp-6.3.0.tar.xz
56+
57+
RUN wget https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.2.tar.xz && \
58+
tar -xf mpfr-4.2.2.tar.xz && \
59+
cd mpfr-4.2.2 && \
60+
./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu \
61+
--with-gmp=/usr/riscv64-linux-gnu && \
62+
make -j8 && \
63+
sudo make install && \
64+
cd .. && \
65+
rm -rf mpfr-4.2.2 && \
66+
rm mpfr-4.2.2.tar.xz
67+
68+
RUN wget https://ftp.gnu.org/gnu/mpc/mpc-1.4.1.tar.xz && \
69+
tar -xf mpc-1.4.1.tar.xz && \
70+
cd mpc-1.4.1 && \
71+
./configure --host=riscv64-linux-gnu --prefix=/usr/riscv64-linux-gnu \
72+
--with-gmp=/usr/riscv64-linux-gnu \
73+
--with-mpfr=/usr/riscv64-linux-gnu && \
74+
make -j8 && \
75+
sudo make install && \
76+
cd .. && \
77+
rm -rf mpc-1.4.1 && \
78+
rm mpc-1.4.1.tar.xz
79+
80+
# Install gcc-7 and g++-7.
81+
RUN wget https://ftp.gnu.org/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.xz && \
82+
tar -xf gcc-7.5.0.tar.xz && \
83+
cd gcc-7.5.0 && \
84+
./contrib/download_prerequisites && \
85+
cd .. && \
86+
mkdir gcc-7 && \
87+
cd gcc-7 && \
88+
../gcc-7.5.0/configure --prefix=/usr/local/gcc7 --enable-languages=c,c++ \
89+
--disable-multilib --disable-libsanitizer && \
90+
make -j8 && \
91+
sudo make install && \
92+
cd .. && \
93+
rm -rf gcc-7 && \
94+
rm -rf gcc-7.5.0 && \
95+
rm gcc-7.5.0.tar.xz
96+
97+
# Install gcc-8 and g++-8.
98+
RUN wget https://ftp.gnu.org/gnu/gcc/gcc-8.5.0/gcc-8.5.0.tar.xz && \
99+
tar -xf gcc-8.5.0.tar.xz && \
100+
cd gcc-8.5.0 && \
101+
./contrib/download_prerequisites && \
102+
cd .. && \
103+
mkdir gcc-8 && \
104+
cd gcc-8 && \
105+
../gcc-8.5.0/configure --prefix=/usr/local/gcc8 --enable-languages=c,c++ \
106+
--disable-multilib --disable-libsanitizer && \
107+
make -j8 && \
108+
sudo make install && \
109+
cd .. && \
110+
rm -rf gcc-8 && \
111+
rm -rf gcc-8.5.0 && \
112+
rm gcc-8.5.0.tar.xz
113+
26114

27115
# Debian has a multilib setup, so we need to symlink the asm directory.
28116
# For more information, see https://wiki.debian.org/Multiarch/LibraryPathOverview

0 commit comments

Comments
 (0)