Skip to content

Commit

Permalink
Refactor Ubuntu Focal gcc-10 setup and update related usage instructi…
Browse files Browse the repository at this point in the history
…ons. (#371)
  • Loading branch information
kirkrodrigues authored Apr 29, 2024
1 parent 7df1e4c commit 90214ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 1 addition & 9 deletions docs/src/dev-guide/components-core/ubuntu-focal-deps-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 90214ed

Please sign in to comment.