我可以从 Amazon Linux 上的二进制文件安装最新的 gcc 吗?

我可以从 Amazon Linux 上的二进制文件安装最新的 gcc 吗?

我在从最新的 2017.03 AMI 启动的 EC2 实例上使用 Amazon Linux (ami-6df1e514)。

该发行版自 2013 年起附带g++4.8.3。我需要一些可以编译 C++14 的更新版本。

有什么办法可以gcc从某种二进制文件中安装更新的版本,还是我只能从源代码进行编译?

我在亚马逊仓库中没有看到任何看起来最新的内容:

[ec2-user@ip-... ~]$ yum list \*gcc\*
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
gcc.noarch                                                   4.8.3-3.20.amzn1                                      @amzn-main
gcc-c++.noarch                                               4.8.3-3.20.amzn1                                      @amzn-main
gcc-gfortran.noarch                                          4.8.3-3.20.amzn1                                      @amzn-main
gcc48.x86_64                                                 4.8.3-9.111.amzn1                                     @amzn-main
gcc48-c++.x86_64                                             4.8.3-9.111.amzn1                                     @amzn-main
gcc48-gfortran.x86_64                                        4.8.3-9.111.amzn1                                     @amzn-main
libgcc48.x86_64                                              4.8.3-9.111.amzn1                                     installed 
Available Packages
gcc-gnat.noarch                                              4.8.3-3.20.amzn1                                      amzn-main 
gcc44.x86_64                                                 4.4.6-4.81.amzn1                                      amzn-main 
gcc44-c++.x86_64                                             4.4.6-4.81.amzn1                                      amzn-main 
gcc44-gfortran.x86_64                                        4.4.6-4.81.amzn1                                      amzn-main 
gcc44-gnat.x86_64                                            4.4.6-4.81.amzn1                                      amzn-main 
gcc44-objc.x86_64                                            4.4.6-4.81.amzn1                                      amzn-main 
gcc44-objc++.x86_64                                          4.4.6-4.81.amzn1                                      amzn-main 
gcc48-gnat.x86_64                                            4.8.3-9.111.amzn1                                     amzn-main 
gcc48-plugin-devel.x86_64                                    4.8.3-9.111.amzn1                                     amzn-main 
libgcc44.i686                                                4.4.6-4.81.amzn1                                      amzn-main 
libgcc44.x86_64                                              4.4.6-4.81.amzn1                                      amzn-main 
libgcc48.i686                                                4.8.3-9.111.amzn1                                     amzn-main 

是否有替代方案、测试 repo 或者包含更新软件包的东西?

答案1

使用新的 Amazon Linux 2https://aws.amazon.com/amazon-linux-2/其默认 repo 中有 gcc v7.2.1。

答案2

目前看起来是这样的:

# yum list \*gcc10\*
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
gcc10.x86_64                                   10.3.1-1.amzn2.0.1                    @amzn2-core
gcc10-binutils.x86_64                          2.35-21.amzn2.0.1                     @amzn2-core
gcc10-binutils-gold.x86_64                     2.35-21.amzn2.0.1                     @amzn2-core
Available Packages
gcc10-binutils.i686                            2.35-21.amzn2.0.1                     amzn2-core 
gcc10-binutils-devel.x86_64                    2.35-21.amzn2.0.1                     amzn2-core 
gcc10-c++.x86_64                               10.3.1-1.amzn2.0.1                    amzn2-core 
gcc10-gdb-plugin.x86_64                        10.3.1-1.amzn2.0.1                    amzn2-core 
gcc10-plugin-devel.x86_64                      10.3.1-1.amzn2.0.1                    amzn2-core

因此只需执行: yum install -y gcc10.x86_64 gcc10-c++.x86_64并检查:

# gcc10-gcc --version
gcc10-gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)
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.```

相关内容