CentOS6.6でsasscのアップデート失敗

Railsでsassc-railsを使っていて、最近アップデートしたらsasscが1.11.4から1.12.1上がり、bundleが失敗する様になった。

エラーの内容はこんな感じ（長いので一部省略してます）。

```
bundle
Warning: the running version of Bundler (1.16.1) is older than the version that created the lockfile (1.16.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Fetching gem metadata from https://rubygems.org/.........
Using rake 12.3.1
...（省略）
Fetching sassc 1.12.1
Installing sassc 1.12.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sassc-1.12.1/ext
/home/admin/.rbenv/versions/2.5.1/bin/ruby -rrubygems /home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/rake-12.3.1/exe/rake
RUBYARCHDIR=/home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/sassc-1.12.1 RUBYLIBDIR=/home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/sassc-1.12.1
cd libsass
make lib/libsass.so
mkdir lib
cc -Wall -O2 -I /home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sassc-1.12.1/ext/libsass/include -fPIC -fPIC -c -o src/cencode.o src/cencode.c
src/cencode.c: In function ‘base64_encode_block’:
src/cencode.c:50: 警告: 空の宣言です
src/cencode.c:64: 警告: 空の宣言です
g++ -Wall -O2 -std=c++0x -I /home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sassc-1.12.1/ext/libsass/include -fPIC -fPIC -c -o src/ast.o src/ast.cpp
In file included from src/ast.cpp:2:
src/ast.hpp: In member function ‘virtual size_t Sass::Vectorized<T>::hash()’:
src/ast.hpp:336: error: expected initializer before ‘:’ token
src/ast.hpp:339: error: expected primary-expression before ‘}’ token
src/ast.hpp:339: error: expected ‘;’ before ‘}’ token
src/ast.hpp:339: error: expected primary-expression before ‘}’ token
src/ast.hpp:339: error: expected ‘)’ before ‘}’ token
src/ast.hpp:339: error: expected primary-expression before ‘}’ token
...（省略）
src/ast.cpp:2226: error: expected ‘}’ at end of input
src/ast.cpp: At global scope:
src/ast.cpp:2226: error: expected ‘}’ at end of input
src/units.hpp:11: 警告: ‘Sass::PI’ defined but not used
make: *** [src/ast.o] エラー 1
rake aborted!
Command failed with status (2): [make lib/libsass.so...]

Tasks: TOP => lib/libsass.so
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sassc-1.12.1 for inspection.
Results logged to /home/admin/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/sassc-1.12.1/gem_make.out

An error occurred while installing sassc (1.12.1), and Bundler cannot continue.
Make sure that `gem install sassc -v '1.12.1'` succeeds before bundling.

In Gemfile:
  sassc-rails was resolved to 1.3.0, which depends on
    sassc
```

libsassのコンパイルに失敗してる様。[調べてみると](https://github.com/sass/sassc-ruby/issues/37)どうやらGCCのバージョンを上げないとダメな模様。

現在のバージョンは...

```
$ gcc --version | head -n1
gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
```

[この辺](https://qiita.com/bezeklik/items/967aa010798c7ea9f7ea)を参考にアップデートしました。記事は`devtoolset-4`ですが、現在は[7](https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/7/html/)が出てるのでせっかくだから最新を入れました。

```
yum install centos-release-scl-rh
yum install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
```

ログインの度に`scl enable devtoolset-7 'bash'`とコマンドを打たないと切り替わらないので`/etc/profile.d`に下記を登録。

```
cat << _EOF_ > /etc/profile.d/devtoolset.sh
#!/bin/bash
source scl_source enable devtoolset-7
_EOF_
```

```
gcc --version | head -n1
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
```

```
bundle
...（省略）
Installing sassc 1.12.1 with native extensions
...（省略）
Bundle complete! 34 Gemfile dependencies, 121 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
```

無事成功。