I'm using Amazon Linux on an EC2 instance started from the most recent 2017.03 AMI (ami-6df1e514).

This distribution comes with g++ 4.8.3 from 2013. I need something more recent that can compile C++14.

Is there any way to install a more recent gcc from some sort of binaries, or am I stuck compiling it from source?

I'm not seeing anything in the Amazon repos that looks recent:

[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 

Is there an alternative, testing repo or something that contains more recent packages?

  • What's the issue? – bcattle Aug 14 '17 at 19:22
  • 1
    Many packages available for Amazon Linux are out of date. The best approach is to use Ubuntu. If you have to start with AL your options are to find a repository that's up to date (Centos) or build from source. – Tim Aug 14 '17 at 19:33

Use the new Amazon Linux 2 at https://aws.amazon.com/amazon-linux-2/ which has gcc v7.2.1 in it's default repo.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.