Ruby Compass ERROR: Failed to build gem native extension

7.5k views Asked by At

Hi I am running Ubuntu 15.04 and I am trying to install the Compass gem. I did a gem update like the Compass website told me to do. Then I tried to install Compass and got the following error.

Building native extensions.  This could take a while...
ERROR:  Error installing compass:
ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 -r ./siteconf20150609-16406-5iavn8.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/ffi-1.9.8 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86-linux/2.1.0/ffi-1.9.8/gem_make.out

This is the output from the gem_make.out file

/usr/bin/ruby2.1 -r ./siteconf20150609-16446-49gin0.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Not sure what to do at this point. Thanks!

1

There are 1 answers

0
Martin Konecny On BEST ANSWER

mkmf.rb can't find header files for ruby at

You need the ruby dev headers files to compile gems.

You need the package ruby2.1-dev.

You may also need other packages like build-essential.

Try the following:

sudo apt-get install ruby2.1-dev build-essential

On earlier versions of Ubuntu such as 14.04, you will need the ruby2.0-dev package instead.

sudo apt-get install ruby2.0-dev build-essential