Gem install does not work with "ruby: invalid option -H (-h will show valid parameters) (RuntimeError)"

running gem install ffi on OSX Mountain lion gives the following error.

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/ ruby-1.9.3-p374@hugo /gems/ffi-1.8.1 for inspection. 

This happens with any native extension. Using the ruby ​​system (1.8.7), I can install gems with native extensions. He even worked with 1.9.3. but after the "gem update is installed", I am stuck.

Installed gems on my machine:

 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) 

It seems like a dumb typo, but I can't find where.

Any hints are welcome.

Meanwhile, I installed ruby ​​2.0.0-rc1 in my rvm. With this option, I could set gems with native extensions. I updated the gems to the same versions in version 1.9.3 as in 2.0.0, but the problem still exists.

+4
source share
1 answer

Do you use homebrew ? If so, try installing ffi via brew install libffi before running bundle .

Why did you run gem update installed ? You should just let Bundler process updates for you: bundle or bundle update gem_xyz . If you want to add a new stone, just add it to the Gemfile.

I assume that when you updated all your gems, one of them was updated to depend on FFI. You can verify this by doing a Gemfile.lock search in Gemfile.lock . Once you know which pearl depends on it, you decide whether to fix this stone in an earlier version of your Gemfile and get rid of the dependencies altogether or proceed with installing lib.

0
source

Source: https://habr.com/ru/post/1484435/


All Articles