Skip to content

Commit 7d759da

Browse files
committed
Only install debhelper in gcc images, because of hard dependency from libtool
1 parent 5bb784d commit 7d759da

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

docker/debian/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by provi
4040
pkgs+=(cmake) # Required build tool.
4141
pkgs+=(curl) # Dependency for tools requiring downloading data.
4242
pkgs+=(dpkg-dev) # Required packaging tool.
43-
pkgs+=(debhelper) # Required packaging tool.
4443
pkgs+=(file) # Required packaging tool.
4544
pkgs+=(git) # Required build tool.
4645
pkgs+=(gpg) # Dependency for tools requiring signing or encrypting/decrypting.
@@ -168,11 +167,19 @@ apt-get update
168167
apt-get install -t llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} -y --no-install-recommends clang-${CLANG_VERSION} llvm-${CLANG_VERSION}
169168
apt-get clean
170169
rm -rf /var/lib/apt/lists/*
170+
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${CLANG_VERSION} 999
171+
update-alternatives --install \
172+
/usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100 \
173+
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION}
174+
update-alternatives --install \
175+
/usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${CLANG_VERSION} 100
176+
update-alternatives --auto cc
177+
update-alternatives --auto clang
178+
update-alternatives --auto llvm-cov
171179
EOF
180+
172181
ENV CC=/usr/bin/clang-${CLANG_VERSION}
173182
ENV CXX=/usr/bin/clang++-${CLANG_VERSION}
174-
# This is required by some build dependencies
175-
RUN update-alternatives --install /usr/bin/cc cc $CC 999
176183

177184
# Check that the installed Clang version matches the expected version.
178185
RUN <<EOF

docker/rhel/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@ dnf clean -y all
5454
rm -rf /var/cache/dnf/*
5555
update-alternatives --install /usr/bin/cc cc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc 999
5656
update-alternatives \
57-
--install /usr/bin/gcc gcc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc ${GCC_VERSION} \
57+
--install /usr/bin/gcc gcc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc 100 \
5858
--slave /usr/bin/g++ g++ /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/g++ \
5959
--slave /usr/bin/cpp cpp /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/cpp \
6060
--slave /usr/bin/gcov gcov /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov \
6161
--slave /usr/bin/gcov-dump gcov-dump /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov-dump-${GCC_VERSION} \
6262
--slave /usr/bin/gcov-tool gcov-tool /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcov-tool-${GCC_VERSION}
63+
update-alternatives --auto cc
64+
update-alternatives --auto gcc
6365
EOF
6466
ENV CC=/usr/bin/gcc
6567
ENV CXX=/usr/bin/g++
@@ -139,11 +141,12 @@ RUN <<EOF
139141
dnf install -y --setopt=tsflags=nodocs clang llvm
140142
dnf clean -y all
141143
rm -rf /var/cache/dnf/*
144+
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 999
145+
update-alternatives --auto cc
142146
EOF
147+
143148
ENV CC=/usr/bin/clang
144149
ENV CXX=/usr/bin/clang++
145-
# This is required by some build dependencies
146-
RUN update-alternatives --install /usr/bin/cc cc $CC 999
147150

148151
# Check that the installed Clang version is not older than the minimum required.
149152
ARG MINIMUM_CLANG_VERSION=16

docker/ubuntu/Dockerfile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by provi
2929
pkgs+=(cmake) # Required build tool.
3030
pkgs+=(curl) # Dependency for tools requiring downloading data.
3131
pkgs+=(dpkg-dev) # Required packaging tool.
32-
pkgs+=(debhelper) # Required packaging tool.
3332
pkgs+=(file) # Required packaging tool.
3433
pkgs+=(git) # Required build tool.
3534
pkgs+=(gpg) # Dependency for tools requiring signing or encrypting/decrypting.
@@ -61,22 +60,26 @@ FROM base AS gcc
6160
# This is not inherited from base image, ensure no manual interaction needed.
6261
ARG DEBIAN_FRONTEND=noninteractive
6362

64-
# Install GCC and create the necessary symlinks.
63+
# Install GCC and create the necessary symlinks. We only support packaging with
64+
# gcc because of the hard package dependencies from libtool to gcc
6565
ARG GCC_VERSION
6666
RUN <<EOF
6767
apt-get update
6868
apt-get install -y --no-install-recommends \
6969
gcc-${GCC_VERSION} \
70-
g++-${GCC_VERSION}
70+
g++-${GCC_VERSION} \
71+
debhelper
7172
apt-get clean
7273
rm -rf /var/lib/apt/lists/*
7374
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${GCC_VERSION} 999
7475
update-alternatives \
75-
--install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} ${GCC_VERSION} \
76+
--install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
7677
--slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} \
7778
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_VERSION} \
7879
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-${GCC_VERSION} \
7980
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-${GCC_VERSION}
81+
update-alternatives --auto cc
82+
update-alternatives --auto gcc
8083
EOF
8184
ENV CC=/usr/bin/gcc
8285
ENV CXX=/usr/bin/g++
@@ -161,11 +164,19 @@ apt-get install -y --no-install-recommends \
161164
llvm-${CLANG_VERSION}
162165
apt-get clean
163166
rm -rf /var/lib/apt/lists/*
167+
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${CLANG_VERSION} 999
168+
update-alternatives --install \
169+
/usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100 \
170+
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION}
171+
update-alternatives --install \
172+
/usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${CLANG_VERSION} 100
173+
update-alternatives --auto cc
174+
update-alternatives --auto clang
175+
update-alternatives --auto llvm-cov
164176
EOF
177+
165178
ENV CC=/usr/bin/clang-${CLANG_VERSION}
166179
ENV CXX=/usr/bin/clang++-${CLANG_VERSION}
167-
# This is required by some build dependencies
168-
RUN update-alternatives --install /usr/bin/cc cc $CC 999
169180

170181
# Check that the installed Clang version matches the expected version.
171182
RUN <<EOF

0 commit comments

Comments
 (0)