@@ -60,23 +60,26 @@ FROM base AS gcc
6060# This is not inherited from base image, ensure no manual interaction needed.
6161ARG DEBIAN_FRONTEND=noninteractive
6262
63- # 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
6465ARG GCC_VERSION
6566RUN <<EOF
6667apt-get update
6768apt-get install -y --no-install-recommends \
6869 gcc-${GCC_VERSION} \
69- g++-${GCC_VERSION}
70+ g++-${GCC_VERSION} \
71+ debhelper
7072apt-get clean
7173rm -rf /var/lib/apt/lists/*
7274update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${GCC_VERSION} 999
7375update-alternatives \
74- --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} ${GCC_VERSION} \
76+ --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
7577 --slave /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} \
76- --slave /usr/bin/cpp cpp /usr/bin/cpp-${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
8083EOF
8184ENV CC=/usr/bin/gcc
8285ENV CXX=/usr/bin/g++
@@ -161,11 +164,19 @@ apt-get install -y --no-install-recommends \
161164 llvm-${CLANG_VERSION}
162165apt-get clean
163166rm -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
164176EOF
177+
165178ENV CC=/usr/bin/clang-${CLANG_VERSION}
166179ENV 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.
171182RUN <<EOF
0 commit comments