我正在尝试在 GCC 7 下运行测试。根据如何安装 gcc-7 或 clang 4.0?在 Ubuntu.SE 上,我们可以执行以下操作在 Ubuntu 上安装 GCC 7:
add-apt-repository ppa:ubuntu-toolchain-r/test && apt-get update && apt-get install -y gcc-7
Run Code Online (Sandbox Code Playgroud)
该命令在安装时失败:
# apt-get install -y gcc-7
...
E: Unable to locate package gcc-7
Run Code Online (Sandbox Code Playgroud)
并尝试 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'
Run Code Online (Sandbox Code Playgroud)
根据List all packages from a repository in ubuntu / debian on Server Fault ,我们可以在特定的 repo 中搜索一个包:
# grep ^Package: /var/lib/apt/lists/ppa.launchpad.net_*_Packages | grep gcc-7
#
Run Code Online (Sandbox Code Playgroud)
但我不确定上面的命令是否正在搜索ppa:ubuntu-toolchain-r。
我把东西拼凑在一起,但它们没有按预期工作。要么 Ubuntu.SE 答案错误,要么服务器故障搜索失败,要么我做错了什么。
(我没有可用于gcc-7 包的 Debain 8 机器,而且 Fedora 25 似乎缺少 GCC 7。所以我几乎被 Ubuntu 困住了)。
我究竟做错了什么?或者,我如何安装 GCC 7?
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety
Run Code Online (Sandbox Code Playgroud)
要gcc-7在 ubuntu 上安装,您应该使用这个ppa:
sudo add-apt-repository ppa:jonathonf/gcc
sudo apt-get update
Run Code Online (Sandbox Code Playgroud)
然后运行: 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)
Run Code Online (Sandbox Code Playgroud)
安装gcc-7:
sudo apt install gcc-7
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
36569 次 |
| 最近记录: |