安装fcgi时出现Rails错误:无法构建gem原生扩展

时间:2012-10-10 20:08:32

标签: ruby-on-rails ruby ruby-on-rails-3

我正在运行命令

bundle install

在我的Rails项目中,它给出了错误:

...
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.

2 个答案:

答案 0 :(得分:18)

您需要安装fcgi开发包才能构建本机扩展(并且您必须先安装C构建链)。你没有在这里指定你的发行版,但是在Red Hat(以及像Fedora这样的衍生版本)你通常会这样做:

sudo yum install fcgi-devel

和Debian(和Ubuntu)你可以这样做:

sudo apt-get install libfcgi-dev

我对Debian软件包的名称并不是100%肯定,但你应该很容易理解它。

答案 1 :(得分:8)

如果你在MacOS X上使用fcgi gem遇到同样的错误(在10.7.5上测试)。您可以使用自制程序(http://mxcl.github.com/homebrew/)获取所需的开发包:

brew install fcgi

然后你应该全部安装gem:

gem install fcgi -v '0.8.8'