@@ -29,7 +29,6 @@ pkgs+=(ca-certificates) # Enable TLS verification for HTTPS connections by provi
2929pkgs+=(cmake) # Required build tool.
3030pkgs+=(curl) # Dependency for tools requiring downloading data.
3131pkgs+=(dpkg-dev) # Required packaging tool.
32- pkgs+=(debhelper) # Required packaging tool.
3332pkgs+=(file) # Required packaging tool.
3433pkgs+=(git) # Required build tool.
3534pkgs+=(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.
6261ARG 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
6565ARG GCC_VERSION
6666RUN <<EOF
6767apt-get update
6868apt-get install -y --no-install-recommends \
6969 gcc-${GCC_VERSION} \
70- g++-${GCC_VERSION}
70+ g++-${GCC_VERSION} \
71+ debhelper
7172apt-get clean
7273rm -rf /var/lib/apt/lists/*
7374update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${GCC_VERSION} 999
7475update-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
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