by mars on 2005-08-06 2 Comments
filed in Work with tags , , ,

Do you get header not found errors when installing a Ruby Gem? (In my case, it's the FastCGI bindings.)

The problem looks something like this:

~/rubygems-0.8.11 >>> mars >>>  ~/bin/gem install fcgi
Attempting local installation of 'fcgi'
Local gem file not found: fcgi*.gem
Attempting remote installation of 'fcgi'
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (RuntimeError)
  ERROR: Failed to build gem native extension.
Gem files will remain installed in /home2/mars/lib/ruby/gems/1.8/gems/fcgi- for inspection.
ruby extconf.rb install fcgi\nchecking for fcgiapp.h... no
checking for fastcgi/fcgiapp.h... no

This error is because the header [*.h] files are:

  1. Not installed; If "fcgiapp.h" is the problem, make sure you've installed the FastCGI Dev kit.

  2. In a non-standard location; the Ruby Gem configuration script "extconf.rb" doesn't search in Ruby's originally compiled include directory (the directory that was specified using the "--includedir" option when Ruby was built.)

Instead, ya gotta get all specific using the CONFIGURE_ARGS environment variable:

In c shell [tcsh]:

setenv CONFIGURE_ARGS "with-fcgi-include=/path/to/include"

In sh [bash]:

export CONFIGURE_ARGS="with-fcgi-include=/path/to/include"

Make sure to replace the 'fcgi' in that value with your problematic Gem's name & '/path/to/include' with the path to your special include directory.

Then, try your "gem install" again!

2 Responses to “'gem install' & A Non-standard Include Directory”

aashutosh commented
2007-11-30 at 12:48 AM

Excellent it worked :)

dave commented
2008-10-06 at 01:53 PM


This helped me fix my gems on an out-of-date shared host. Thanks!

Leave a Reply

Markdown is in effect.

Everything is here.