Centos – RubyGem installation can’t find header files

centoscentos5rubyrubygems

I'm running Ruby 1.9.3 on CentOS 5.3. I installed it by compiling Ruby 1.9.3 from source, along with libyaml. I'm also using rbenv to manage versions, so I placed the compiled installation in ~/.rbenv/versions/1.9.3-p286, which is where rbenv keeps versions of Ruby.

Everything's been working great, and I'm now installing Gems. One gem in particular isn't installing yet, however, which makes me think I may be missing a dependency. It's an internal gem, so not listed on RubyGems, but here's the output of a gem install:

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

        /home/fs/.rbenv/versions/1.9.3-p286/bin/ruby extconf.rb
checking for expat.h... no
checking for xmlparse.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

I'm a Debian guy, so really not that experienced with Redhat/RPM packages and whatnot, so I'm not sure what dependencies I'm missing on my system to get this Gem to install.

Can anyone help me know what packages I need to install for these missing header files missing above?

Best Answer

Look for the missing files:

checking for expat.h... no
checking for xmlparse.h... no

Now use yum to search for the package which provides those files:

yum provides */expat.h

You'll see multiple packages here. The one you're looking for is the one that contains /usr/include/expat.h as that is the standard include directory. So install the indicated package:

yum install expat-devel

Repeat the process for the other file:

yum provides */xmlparse.h

Here you will fail and get the error No matches found. In this case, you'll need to either read the gem source code or contact its developer to find out what package he/she meant for you to have. It should be listed in the gem's documentation as a system requirement (if the developer bothered to write documentation).

Related Topic