diff --git a/components/core/tools/docker-images/clp-env-base-ubuntu-focal/Dockerfile b/components/core/tools/docker-images/clp-env-base-ubuntu-focal/Dockerfile index 72c2f8a62..f50ccadb4 100644 --- a/components/core/tools/docker-images/clp-env-base-ubuntu-focal/Dockerfile +++ b/components/core/tools/docker-images/clp-env-base-ubuntu-focal/Dockerfile @@ -9,15 +9,10 @@ ADD ./tools/scripts/lib_install ./tools/scripts/lib_install # `install-prebuilt-packages.sh` and `install-packages-from-source.sh`. RUN ./tools/scripts/lib_install/ubuntu-focal/install-prebuilt-packages.sh -# Set gcc/g++ 10 as the default compiler -RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 -RUN update-alternatives --set gcc /usr/bin/gcc-10 -RUN update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 20 +# Set cpp, cc, and c++ to v10 RUN update-alternatives --set cc /usr/bin/gcc-10 -RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 -RUN update-alternatives --set g++ /usr/bin/g++-10 -RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-10 20 RUN update-alternatives --set c++ /usr/bin/g++-10 +RUN update-alternatives --set cpp /usr/bin/cpp-10 RUN ./tools/scripts/lib_install/ubuntu-focal/install-packages-from-source.sh diff --git a/components/core/tools/scripts/lib_install/ubuntu-focal/install-prebuilt-packages.sh b/components/core/tools/scripts/lib_install/ubuntu-focal/install-prebuilt-packages.sh index a6c0d950b..9fb3da89f 100755 --- a/components/core/tools/scripts/lib_install/ubuntu-focal/install-prebuilt-packages.sh +++ b/components/core/tools/scripts/lib_install/ubuntu-focal/install-prebuilt-packages.sh @@ -26,3 +26,12 @@ DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ python3 \ python3-pip \ zlib1g-dev + +# Add alternatives for cpp-10, gcc-10, and g++-10 +# NOTE: We use a low priority to avoid affecting the prioritization of any existing alternatives +# on the user's system. +update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 0 \ + --slave /usr/share/mna/man1/cc.1.gz cc.1.gz /usr/share/man/man1/gcc.1.gz +update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-10 0 \ + --slave /usr/share/mna/man1/c++.1.gz c++.1.gz /usr/share/man/man1/g++.1.gz +update-alternatives --install /lib/cpp cpp /usr/bin/cpp-10 0 diff --git a/docs/src/dev-guide/components-core/ubuntu-focal-deps-install.md b/docs/src/dev-guide/components-core/ubuntu-focal-deps-install.md index 447969354..53ee0ecbd 100644 --- a/docs/src/dev-guide/components-core/ubuntu-focal-deps-install.md +++ b/docs/src/dev-guide/components-core/ubuntu-focal-deps-install.md @@ -21,15 +21,7 @@ components/core/tools/scripts/lib_install/ubuntu-focal/install-all.sh Enable GCC 10 as the default compiler by running: ```shell -update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 -update-alternatives --set gcc /usr/bin/gcc-10 - -update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 20 update-alternatives --set cc /usr/bin/gcc-10 - -update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 -update-alternatives --set g++ /usr/bin/g++-10 - -update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-10 20 update-alternatives --set c++ /usr/bin/g++-10 +update-alternatives --set cpp /usr/bin/cpp-10 ```