manjaro这玩意,没有自身带gcc,不知道是不是自己按照版本的原因,反正需要自己手动安装
两步即可完成,没必要手段去下载gcc文件自己编译
一.查询gcc
pacman -Ss gcc
得到如下结果:
core/gcc 10.2.0-2 (base-devel)
The GNU Compiler Collection - C and C++ frontends
core/gcc-ada 10.2.0-2
Ada front-end for GCC (GNAT)
core/gcc-d 10.2.0-2
D frontend for GCC
core/gcc-fortran 10.2.0-2
Fortran front-end for GCC
core/gcc-go 10.2.0-2
Go front-end for GCC
core/gcc-libs 10.2.0-2 [已安装]
Runtime libraries shipped by GCC
core/gcc-objc 10.2.0-2
Objective-C front-end for GCC
core/lib32-gcc-libs 10.2.0-2 (multilib-devel) [已安装]
32-bit runtime libraries shipped by GCC
extra/libgsystem 2015.2+4+gd606bec-3
"Copylib" for system service modules using GLib with GCC
community/aarch64-linux-gnu-gcc 10.2.0-1
The GNU Compiler Collection - cross compiler for ARM64 target
community/arduino-avr-core 1.8.3-1
Arduino AVR core with upstream avr-gcc and avrdude
community/arm-none-eabi-gcc 10.2.0-1
The GNU Compiler Collection - cross compiler for ARM EABI (bare-metal)
target
community/avr-gcc 10.2.0-1
The GNU AVR Compiler Collection
community/colorgcc 1.4.5-2
A Perl wrapper to colorize the output of compilers with warning/error
messages matching the gcc output format
community/gcc8 8.4.0-1
The GNU Compiler Collection - C and C++ frontends (8.x.x)
community/gcc8-fortran 8.4.0-1
Fortran front-end for GCC (8.x.x)
community/gcc8-libs 8.4.0-1
Runtime libraries shipped by GCC (8.x.x)
community/gcc9 9.3.0-3
The GNU Compiler Collection - C and C++ frontends (9.x.x)
community/gcc9-fortran 9.3.0-3
Fortran front-end for GCC (9.x.x)
community/gcc9-libs 9.3.0-3
Runtime libraries shipped by GCC (9.x.x)
community/ghdl-gcc 0.37-9
VHDL simulator (GCC backend)
community/lm32-elf-gcc 10.1.0-1
The GNU Compiler Collection - cross compiler for LatticeMico32
(bare-metal) target
community/mingw-w64-gcc 10.2.0-1 (mingw-w64-toolchain mingw-w64)
Cross GCC for the MinGW-w64 cross-compiler
community/nds32le-elf-gcc 10.1.0-1
The GNU Compiler Collection - cross compiler for Andes 32 little-endian
(bare-metal) target
community/or1k-elf-gcc 10.1.0-1
The GNU Compiler Collection - cross compiler for OpenRISC 1000
(bare-metal) target
community/riscv64-elf-gcc 10.1.0-1
The GNU Compiler Collection - cross compiler for RISCV64 (bare-metal)
target
community/riscv64-linux-gnu-gcc 10.2.0-1 (risc-v)
Cross compiler for 32-bit and 64-bit RISC-V
archlinuxcn/arm-linux-gnueabihf-gcc 9.1.0-2
The GNU Compiler Collection - C and C++ frontends (arm-linux-gnueabihf)
archlinuxcn/arm-linux-gnueabihf-gcc-fortran 9.1.0-2
Fortran front-end for GCC (arm-linux-gnueabihf)
archlinuxcn/arm-linux-gnueabihf-gcc-libs 9.1.0-2
Runtime libraries shipped by GCC (arm-linux-gnueabihf)
archlinuxcn/arm-linux-gnueabihf-gcc-objc 9.1.0-2
Objective-C front-end for GCC (arm-linux-gnueabihf)
archlinuxcn/emake-git 3.6.9.r60.a0bf239-1
Yet the simplest build toolchain for gcc/clang projects
archlinuxcn/libgccjit 10.2.0-3
Just-In-Time Compilation using GCC.
archlinuxcn/mingw-w64-gcc-base 10.1.0-1 (mingw-w64-bootstrap mingw-w64)
Cross GCC for the MinGW-w64 cross-compiler (bootstrap)
二.安装
[aspiree1431 opt]# pacman -S core/gcc
正在解析依赖关系...
正在查找软件包冲突...
软件包 (5) binutils-2.35-2 elfutils-0.181-1 libmicrohttpd-0.9.71-1
libmpc-1.1.0-2 gcc-10.2.0-2
下载大小: 31.59 MiB
全部安装大小: 181.53 MiB
:: 进行安装吗? [Y/n] y
:: 正在获取软件包......
libmpc-1.1.0-2-x... 65.1 KiB 160 KiB/s 00:00 [##################] 100%
gcc-10.2.0-2-x86_64 31.5 MiB 122 KiB/s 04:25 [##################] 100%
(5/5) 正在检查密钥环里的密钥 [##################] 100%
(5/5) 正在检查软件包完整性 [##################] 100%
(5/5) 正在加载软件包文件 [##################] 100%
(5/5) 正在检查文件冲突 [##################] 100%
(5/5) 正在检查可用存储空间 [##################] 100%
:: 正在处理软件包的变化...
(1/5) 正在安装 libmicrohttpd [##################] 100%
(2/5) 正在安装 elfutils [##################] 100%
(3/5) 正在安装 binutils [##################] 100%
(4/5) 正在安装 libmpc [##################] 100%
(5/5) 正在安装 gcc [##################] 100%
gcc 的可选依赖
lib32-gcc-libs: for generating code for 32-bit ABI [已安装]
:: 正在运行事务后钩子函数...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Updating the info directory file...
[zl-aspiree1431 opt]# gcc
gcc: 致命错误:没有输入文件
编译中断。
至此,gcc安装成功了