2013-06-04 34 views
4

在OSX上運行gem install ffi Mountain lion會產生以下錯誤。gem install with「ruby:invalid option -H(-h將顯示有效選項)(RuntimeError)」

gem install ffi 
Building native extensions. This could take a while... 
ERROR: Error installing ffi: 
    ERROR: Failed to build gem native extension. 

    /beweiche.rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb 
/beweiche.rvm/rubies/ruby-1.9.3-p374/bin/ruby: invalid option -H (-h will show valid options) (RuntimeError) 


Gem files will remain installed in /beweiche.rvm/gems/[email protected]/gems/ffi-1.8.1 for inspection. 

這發生在任何本地擴展。 使用系統紅寶石(1.8.7)我可以用本機擴展安裝寶石。它甚至與1.9.3一起工作。但在做了「安裝寶石更新」之後,我陷入了困境。

在我的機器上安裝寶石:

bundler (1.2.3) 
coderay (1.0.9) 
diff-lcs (1.2.4) 
graph (2.5.2) 
method_source (0.8.1) 
pry (0.9.12.1) 
rake (10.0.3) 
rspec (2.13.0) 
rspec-core (2.13.1) 
rspec-expectations (2.13.0) 
rspec-mocks (2.13.1) 
rubygems-bundler (1.1.0) 
rvm (1.11.3.6) 
slop (3.4.4) 

這似乎是一個愚蠢的錯字的地方,但我找不到在哪裏。

任何提示高度讚賞。

與此同時,我在我的rvm中安裝了ruby 2.0.0-rc1。有了這個設置,我可以用本機擴展安裝寶石。我在1.9.3中將這些寶石升級到2.0.0中的相同版本,但問題仍然存在。

+0

是'/ beweiche.rvm'正確嗎? – fotanus

+0

是的,這是正確的。它被軟鏈接到/ Volumes/Macintosh HD/Users/beweiche/.rvm /以避免路徑中的空間。 – Bernhard

回答

0

你使用homebrew?如果是,請在運行bundle之前嘗試通過brew install libffi安裝ffi。

爲什麼運行gem update installed?您應該讓Bundler處理您的更新:bundlebundle update gem_xyz。如果你想添加一個新的寶石,只需將它添加到Gemfile。

我假設當你更新所有寶石時,其中一個更新爲依賴於FFI。您可以通過在Gemfile.lock中搜索ffi來驗證此情況。一旦你看到哪個gem依賴於它,你就決定是否將Gem修復到Gemfile中的早期版本,並完全擺脫依賴關係,或者使用lib安裝向前移動。

+0

我從來沒有設法在我的機器上做自制工作。我會再試一次,如果不行,我會在這裏再打開一個問題。但是,感謝與bundler的提示。 – Bernhard