如何在网上做自己的网站,dw网站开发,网站seo报表,html做电商网站目录 1 背景2 安装2.1 Ubuntu 20.042.2 Ubuntu 18.04 3 配置4 切换4.1 切换到版本94.2 切换到版本10 1 背景
最近在研究C20中的协程需要安装GCC版本10。用到GCC多版本切换#xff0c;记录步骤。
2 安装
2.1 Ubuntu 20.04
运行如下命令安装两个版本编译器:
sudo apt insta… 目录 1 背景2 安装2.1 Ubuntu 20.042.2 Ubuntu 18.04 3 配置4 切换4.1 切换到版本94.2 切换到版本10 1 背景
最近在研究C20中的协程需要安装GCC版本10。用到GCC多版本切换记录步骤。
2 安装
2.1 Ubuntu 20.04
运行如下命令安装两个版本编译器:
sudo apt install gcc-9 g-9
sudo apt install gcc-10 g-102.2 Ubuntu 18.04
默认安装最高版本gcc-7,添加Toolchain Test Builds PPA个人软件包存档它提供了GCC 10的最新版本
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-9 g-9
sudo apt install gcc-10 g-103 配置
使用update-alternatives命令配置多编译器版本:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g g /usr/bin/g-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g g /usr/bin/g-10说明:
gcc与g版本绑定在一起了修改gcc版本会同时修改g版本
4 切换
使用如下命令切换编译器版本:
sudo update-alternatives --config gcc4.1 切换到版本9
$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-10 100 auto mode1 /usr/bin/gcc-10 100 manual mode2 /usr/bin/gcc-9 90 manual modePress enter to keep the current choice[*], or type selection number: 2查看版本:
$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.3) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g --version
g (Ubuntu 9.4.0-1ubuntu1~20.04.3) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.4.2 切换到版本10
$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-10 100 auto mode1 /usr/bin/gcc-10 100 manual mode2 /usr/bin/gcc-9 90 manual modePress enter to keep the current choice[*], or type selection number: 1查看版本:
$ gcc --version
gcc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g --version
g (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.