結論
もちろんAmazon Linux 2にOSを入れ替えるのが最良だが、とりあえずはこれでしのげる。
sudo yum install gcc72 gcc72-c++
どうしてそんなことしたの?
Rubyのunicornサーバー(Webサーバー)としてAmazon Linux 1のサーバーを使っていたが、ここにsassc-2.1.0というgemをインストールしようとしてg++が古いためにlibsassのビルドで失敗したため。
...
......
compiling ./libsass/src/ast_sel_unify.cpp
compiling ./libsass/src/extend.cpp
linking shared-object sassc/libsass.so
lto1: fatal error: LTO_tags out of range: Range is 0 to 365, value is 2566
compilation terminated.
lto-wrapper: g++ returned 1 exit status
......
...
g++をアップデートしようとしたが、AmazonLinux1で、下記のコマンドで入手できる最新のg++は4.8.3だった。
sudo yum install gcc gcc-c++
探し方
# 検索
yum search "gcc"
# 結果
57 packages excluded due to repository priority protections
============== N/S matched: gcc================
gcc-c++.noarch : C++ support for GCC
gcc-gnat.noarch : Ada 95 support for GCC
gcc44-c++.x86_64 : C++ support for GCC
gcc44-gnat.x86_64 : Ada 95 support for GCC
gcc44-objc.x86_64 : Objective-C support for GCC
gcc44-objc++.x86_64 : Objective-C++ support for GCC
gcc48-c++.x86_64 : C++ support for GCC
gcc48-gnat.x86_64 : Ada 95 support for GCC
gcc48-plugin-devel.x86_64 : Support for compiling GCC plugins
gcc64-c++.x86_64 : C++ support for GCC
gcc64-gdb-plugin.i686 : GCC plugin for GDB
gcc64-gdb-plugin.x86_64 : GCC plugin for GDB
gcc64-plugin-devel.x86_64 : Support for compiling GCC plugins
gcc72-c++.x86_64 : C++ support for GCC
gcc72-gdb-plugin.x86_64 : GCC plugin for GDB
gcc72-plugin-devel.x86_64 : Support for compiling GCC plugins
libgcc44.i686 : GCC version 4.4 shared support library
libgcc44.x86_64 : GCC version 4.4 shared support library
libgcc48.i686 : GCC version 4.8 shared support library
libgcc48.x86_64 : GCC version 4.8 shared support library
libgcc64.i686 : GCC version 6 shared support library
libgcc64.x86_64 : GCC version 6 shared support library
libgcc72.x86_64 : GCC version 7 shared support library
libgccjit.i686 : Library for embedding GCC inside programs and libraries
libgccjit.x86_64 : Library for embedding GCC inside programs and libraries
libgccjit-devel.x86_64 : Support for embedding GCC inside programs and libraries
gcc.noarch : Various compilers (C, C++, Objective-C, ...)
gcc-gfortran.noarch : Fortran support
gcc44.x86_64 : Various compilers (C, C++, Objective-C, ...)
gcc44-gfortran.x86_64 : Fortran support
gcc48.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)
gcc48-gfortran.x86_64 : Fortran support
gcc64.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)
gcc64-gfortran.x86_64 : Fortran support
gcc72.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)
libgomp.i686 : GCC OpenMP v3.0 shared support library
libgomp.x86_64 : GCC OpenMP v4.5 shared support library
libmudflap.i686 : GCC mudflap shared support library
libmudflap.x86_64 : GCC mudflap shared support library
libmudflap44-devel.x86_64 : GCC mudflap support
libquadmath.i686 : GCC __float128 shared support library
libquadmath.x86_64 : GCC __float128 shared support library
参考