设置Ruby on Rails时出错

时间:2011-02-10 23:12:22

标签: ruby-on-rails sqlite amazon-ec2

Following this guide,我正在尝试使用亚马逊的EC2设置Ruby on Rails。对于我的实例,我选择了“基本的32位Amazon Linux AMI 2010.11.1 Beta”。我安装了ruby,sqlite和rubygems。我在链接指南的步骤3.3中运行以下命令

  

捆绑安装

结果如下。我确定我错过了一些东西,但我很茫然。有什么建议吗?

Installing sqlite3 (1.3.3) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems    /installer.rb:529:in `build_extensions': ERROR: Failed to build gem native extension (Gem::Installer::ExtensionBuildError)

/usr/bin/ruby extconf.rb 
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-1.3.3 for inspection.

编辑:按照以下建议安装ruby-devel,我现在除了原始错误之外还会收到此错误。

Installing sqlite3 (1.3.3) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions': 
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

    /usr/bin/ruby extconf.rb 
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).

但是当我尝试运行时

  

yum install sqlite-devel

我被告知:

Package sqlite-devel-3.6.20-1.6.amzn1.i386 already installed and latest version
Nothing to do

4 个答案:

答案 0 :(得分:2)

尝试在

之前安装libsqlite3-dev

$ sudo apt-get install libsqlite3-dev

并在

之后重试安装gem

$ gem install sqlite3-ruby

答案 1 :(得分:2)

除了上面的包之外,请确保你有gcc并安装。

除开发库外,还需要构建您正在安装的gem。

答案 2 :(得分:1)

这对我有用:

yum install ruby-devel
yum install sqlite-devel

不是sqlite3-devel

答案 3 :(得分:0)

在这里冒险,但您可能缺少一些开发包。尝试运行:

yum install ruby-devel sqlite3-devel