Skip to content

Instantly share code, notes, and snippets.

@qrealka
Forked from ArseniyShestakov/add.sh
Created October 26, 2020 19:50
Show Gist options
  • Save qrealka/34b5e1aeb92d1bb0c54c5d54fad8a993 to your computer and use it in GitHub Desktop.
Save qrealka/34b5e1aeb92d1bb0c54c5d54fad8a993 to your computer and use it in GitHub Desktop.
My compiler alternatives
# Cleanup old alternatives
update-alternatives --remove-all gcc
update-alternatives --remove-all g++
update-alternatives --remove-all cc
update-alternatives --remove-all c++
# Add GCC versions
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 10
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++4.9 10
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20
# Add Clang versions
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.7 10
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 20
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-4.0 30
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.7 10
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 20
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-4.0 30
# Add compilers
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
update-alternatives --install /usr/bin/cc cc /usr/bin/clang 40
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 40
update-alternatives --set cc /usr/bin/gcc
update-alternatives --set c++ /usr/bin/g++
update-alternatives --set cc /usr/bin/clang
update-alternatives --set c++ /usr/bin/clang++
# GCC
update-alternatives --set gcc /usr/bin/gcc-4.9
update-alternatives --set g++ /usr/bin/g++-4.9
update-alternatives --set gcc /usr/bin/gcc-5
update-alternatives --set g++ /usr/bin/g++-5
# Clang
update-alternatives --set clang /usr/bin/clang-4.0
update-alternatives --set clang++ /usr/bin/clang++-4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment