问题描述
我正在尝试在GCC 7下运行测试。根据Ubuntu.SE上的How to install gcc-7 or clang 4.0?,我们可以执行以下操作在Ubuntu上安装GCC 7:
add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update && apt-get install -y gcc-7
该命令在安装时失败:
# apt-get install -y gcc-7
...
E: Unable to locate package gcc-7
并尝试7.1:
# apt-get install -y gcc-7.1
...
E: Unable to locate package gcc-7.1
E: Couldn't find any package by glob 'gcc-7.1'
E: Couldn't find any package by regex 'gcc-7.1'
根据服务器故障上的List all packages from a repository in ubuntu / debian,我们可以使用以下命令搜索特定回购包的软件包:
# grep ^Package: /var/lib/apt/lists/ppa.launchpad.net_*_Packages | grep gcc-7
#
但是我不确定上面的命令是否在搜索ppa:ubuntu-toolchain-r
。
我有点拼凑的东西,但它们没有按预期工作。 Ubuntu.SE答案错误,服务器故障搜索失败,或者我做错了。
(我没有可用于gcc-7 package的Debain 8机器,而Fedora 25似乎缺少GCC7。因此,我对Ubuntu几乎一无所知)。
我究竟做错了什么?或者,如何安装GCC 7?
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety
最佳回答
要在ubuntu上安装gcc-7
,您应该使用以下ppa:
sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
然后运行:apt-cache search gcc-7
样本输出:
gcc-7-base - GCC, the GNU Compiler Collection (base package)
gcc-7 - GNU C compiler
gcc-7-multilib - GNU C compiler (multilib support)
gcc-7-plugin-dev - Files for GNU GCC plugin development.
gcc-7-test-results - Test results for the GCC test suite
lib32gcc-7-dev - GCC support library (32 bit development files)
libgcc-7-dev - GCC support library (development files)
gcc-7-doc - Documentation for the GNU compilers (gcc, gobjc, g++)
gcc-7-hppa64-linux-gnu - GNU C compiler (cross compiler for hppa64)
gcc-7-locales - GCC, the GNU compiler collection (native language support files)
gcc-7-source - Source of the GNU Compiler Collection
libx32gcc-7-dev - GCC support library (x32 development files)
gcc-7-offload-nvptx - GCC offloading compiler to NVPTX
lib64gcc-7-dev - GCC support library (64bit development files)
安装gcc-7
:
sudo apt install gcc-7