File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,6 @@ ARG DEBIAN_FRONTEND=noninteractive
156156# Install Clang. Use the LLVM apt repository to access the latest versions. We
157157# must repeat the DEBIAN_VERSION argument here, as it is not inherited from the
158158# base or source images.
159- # Note, gcc is needed for build dependencies.
160159ARG DEBIAN_VERSION
161160ARG CLANG_VERSION
162161RUN <<EOF
@@ -165,13 +164,14 @@ printf "%s\n%s\n" \
165164 "deb [signed-by=/etc/apt/keyrings/llvm.gpg] https://apt.llvm.org/${DEBIAN_VERSION}/ llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} main" \
166165 | tee /etc/apt/sources.list.d/llvm.list
167166apt-get update
168- apt-get install -y --no-install-recommends gcc
169167apt-get install -t llvm-toolchain-${DEBIAN_VERSION}-${CLANG_VERSION} -y --no-install-recommends clang-${CLANG_VERSION} llvm-${CLANG_VERSION}
170168apt-get clean
171169rm -rf /var/lib/apt/lists/*
172170EOF
173171ENV CC=/usr/bin/clang-${CLANG_VERSION}
174172ENV CXX=/usr/bin/clang++-${CLANG_VERSION}
173+ # This is required by some build dependencies
174+ RUN update-alternatives --install /usr/bin/cc cc $CC 999
175175
176176# Check that the installed Clang version matches the expected version.
177177RUN <<EOF
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ dnf remove -y gcc gcc-c++
5252dnf install -y --setopt=tsflags=nodocs gcc-toolset-${GCC_VERSION}-gcc gcc-toolset-${GCC_VERSION}-gcc-c++
5353dnf clean -y all
5454rm -rf /var/cache/dnf/*
55+ update-alternatives --install /usr/bin/cc cc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc 999
5556update-alternatives \
5657 --install /usr/bin/gcc gcc /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/gcc ${GCC_VERSION} \
5758 --slave /usr/bin/g++ g++ /opt/rh/gcc-toolset-${GCC_VERSION}/root/usr/bin/g++ \
@@ -134,14 +135,15 @@ FROM base AS clang
134135
135136# Install Clang. Note that in the RHEL UBIs, we cannot choose the Clang version
136137# to install and we get what is available.
137- # Note, gcc is needed for build dependencies.
138138RUN <<EOF
139- dnf install -y --setopt=tsflags=nodocs clang llvm gcc
139+ dnf install -y --setopt=tsflags=nodocs clang llvm
140140dnf clean -y all
141141rm -rf /var/cache/dnf/*
142142EOF
143143ENV CC=/usr/bin/clang
144144ENV CXX=/usr/bin/clang++
145+ # This is required by some build dependencies
146+ RUN update-alternatives --install /usr/bin/cc cc $CC 999
145147
146148# Check that the installed Clang version is not older than the minimum required.
147149ARG MINIMUM_CLANG_VERSION=16
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ apt-get install -y --no-install-recommends \
6969 g++-${GCC_VERSION}
7070apt-get clean
7171rm -rf /var/lib/apt/lists/*
72+ update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${GCC_VERSION} 999
7273update-alternatives \
7374 --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} ${GCC_VERSION} \
7475 --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} \
@@ -151,19 +152,20 @@ FROM base AS clang
151152# This is not inherited from base image, ensure no manual interaction needed.
152153ARG DEBIAN_FRONTEND=noninteractive
153154
154- # Install Clang. Note, gcc is needed for build dependencies
155+ # Install Clang.
155156ARG CLANG_VERSION
156157RUN <<EOF
157158apt-get update
158159apt-get install -y --no-install-recommends \
159160 clang-${CLANG_VERSION} \
160- llvm-${CLANG_VERSION} \
161- gcc
161+ llvm-${CLANG_VERSION}
162162apt-get clean
163163rm -rf /var/lib/apt/lists/*
164164EOF
165165ENV CC=/usr/bin/clang-${CLANG_VERSION}
166166ENV 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
167169
168170# Check that the installed Clang version matches the expected version.
169171RUN <<EOF
You can’t perform that action at this time.
0 commit comments