gcc 升级

ddatsh

dev #linux #gcc

dnf

dnf list gcc-toolset-13*
dnf install gcc-toolset-13.x86_64 
scl list-collections
scl enable gcc-toolset-13 bash

apt

add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update

version=$(apt-cache pkgnames | sed -nr 's/^gcc-(([0-9]+\.?)+)$/\1/p' \
                             | sort -n | tail -n1)
echo "The latest available GCC version: $version"

apt-get install gcc-$version g++-$version
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$version 60 \
                         --slave   /usr/bin/g++ g++ /usr/bin/g++-$version