问题安装ruby ffi gem依赖项

时间:2014-07-11 21:47:16

标签: ruby-on-rails ruby gem rubygems rvm

我是ruby on rails的新手,我现在正在阅读一本名为" Ruby on Rails Tutorial"迈克尔哈特尔。

安装其中一个gem依赖项时出现问题,我不知道它可能是什么。这是我的宝石文件

source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0146 CHAPTER 3. MOSTLY STATIC PAGES
gem 'rails', '4.0.5'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
gem 'guard-rspec', '2.5.0'
gem 'spork-rails', '4.0.0'
gem 'guard-spork', '1.5.0'
gem 'childprocess', '0.3.3'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
#Uncomment this line on OS X.
gem 'growl', '1.0.3'
# Uncomment these lines on Linux.
# gem 'libnotify', '0.8.0'
# Uncomment these lines on Windows.
# gem 'rb-notifu', '0.0.4'
# gem 'wdm', '0.1.0'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end

以下是我遇到的错误:

*Karls-MacBook-Pro:sample_app karl$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.4
Using tzinfo 0.3.40
Using activesupport 4.0.5
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.5
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.5
Using activemodel 4.0.5
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.5
Using bundler 1.6.2
Using mini_portile 0.6.0
Using nokogiri 1.6.2.1
Using xpath 2.0.0
Using capybara 2.1.0
Using timers 1.1.0
Using celluloid 0.15.2
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
    /Users/karl/.rvm/rubies/ruby-2.0.0-p481/bin/ruby extconf.rb 
/Users/karl/.rvm/rubies/ruby-2.0.0-p481/bin/ruby: invalid switch in RUBYOPT: -C (RuntimeError)
Gem files will remain installed in /Users/karl/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0146 CHAPTER 3. MOSTLY STATIC PAGES/gems/ffi-1.0.11 for inspection.
Results logged to /Users/karl/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0146 CHAPTER 3. MOSTLY STATIC PAGES/gems/ffi-1.0.11/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.0.11), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.0.11'` succeeds before bundling.

所以我尝试用它的版本1.0.11安装ffi,我得到了这个:

Karls-MacBook-Pro:sample_app karl$ gem install ffi -v 1.0.11
Building native extensions.  This could take a while...
ERROR:  Error installing ffi:
    ERROR: Failed to build gem native extension.

    /Users/karl/.rvm/rubies/ruby-2.0.0-p481/bin/ruby extconf.rb
/Users/karl/.rvm/rubies/ruby-2.0.0-p481/bin/ruby: invalid switch in RUBYOPT: -C (RuntimeError)


Gem files will remain installed in /Users/karl/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0146 CHAPTER 3. MOSTLY STATIC PAGES/gems/ffi-1.0.11 for inspection.
Results logged to /Users/karl/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0146 CHAPTER 3. MOSTLY STATIC PAGES/gems/ffi-1.0.11/ext/ffi_c/gem_make.out

这是某种C错误吗?不确定如何解决这个问题。任何帮助,将不胜感激。谢谢

1 个答案:

答案 0 :(得分:1)

尝试brew install libffi,或安装以前版本的gem。见this question