5

I was running the command

bundle install

on my Rails project, and it gave the error:

...
Using activerecord (3.0.11) 
Using activeresource (3.0.11) 
Using bigdecimal (1.1.0) 
Installing fcgi (0.8.8) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/jjboat/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for fcgiapp.h... no
checking for fastcgi/fcgiapp.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.
Paul S.
  • 4,362
  • 10
  • 35
  • 52

2 Answers2

19

You need to install the fcgi development package to be able to build native extensions (and you have to have install a C build chain before that as well). You haven't specified your distro here, but on Red Hat (and derivatives like Fedora) you'll generally do it like this:

sudo yum install fcgi-devel

and on Debian (and Ubuntu) you can do the same like this:

sudo apt-get install libfcgi-dev

I'm not 100% certain about the name of the package in Debian, but it should be easy for you to figure it out.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
  • I'm using Ubuntu 10.04, and it says: sudo apt-get install fcgi-dev [sudo] password for jjboat: Reading package lists... Done Building dependency tree Reading state information... Done E: Couldn't find package fcgi-dev – Paul S. Oct 10 '12 at 20:27
  • 2
    It seems that the package is actually called `libfcgi-dev` in Ubuntu. – Bozhidar Batsov Oct 10 '12 at 20:29
  • Thanks, `libfcgi-dev` is correct. Now it hits an error for `mysql2`. Do you know what package should be installed? An error occurred while installing mysql2 (0.2.17), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.2.17'` succeeds before bundling. – Paul S. Oct 10 '12 at 20:33
  • Well never mind, got it here :) http://stackoverflow.com/questions/8874513/installing-mysql2-gem-for-ruby-on-rails-3-1-0 – Paul S. Oct 10 '12 at 20:35
8

If you hit this same error with the fcgi gem on MacOS X (tested on 10.7.5). You can get the development packages required using homebrew (Link):

brew install fcgi

Then you should be all set to install the gem:

gem install fcgi -v '0.8.8'
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Armin Sadeghi
  • 766
  • 12
  • 19