Unable to install sass gem on CentOS 6.9 with Ruby 2.4
By Iain Cuthbertson
Something changed recently, preventing a VM from fully provisioning. Tracking it down was a bit of a PiTA.
OS: CentOS 6.9
Ruby: 2.4 - installed from source with the gearlingguy.ruby ansible role
Gems to be installed: sass
Output of attempting to install the sass ruby gem
:
$ sudo gem install sass
Fetching: rb-fsevent-0.10.2.gem (100%)
Successfully installed rb-fsevent-0.10.2
Fetching: ffi-1.9.21.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.21/ext/ffi_c
/usr/local/bin/ruby -r ./siteconf20180222-18730-x7wu2n.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR="
Running autoreconf for libffi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
configure.ac:3: error: Autoconf version 2.68 or higher is required
configure.ac:3: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
aclocal: autom4te failed with exit status: 63
autoreconf: aclocal failed with exit status: 63
make: *** ["/usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-linux"/.libs/libffi_convenience.a] Error 63
make failed, exit code 2
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.21 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/ffi-1.9.21/gem_make.out
The issue is with the ffi ruby gem.
Looking at the releases in github, a recent release updated the required version of autoconf installed on the system. Fine for modern systems, not so much for CentOS 6.9.
The solution is to install the ffi ruby gem with the version prior to this recent change:
$ gem install ffi -v 1.9.18
This then allows sass to be installed without complaint!