Error installing gems that use native extensions on Ubuntu, Ruby 1.9.2 via RVM

前端 未结 5 1731

I get an error while trying to install the ffi gem:

~ - 16:54>gem i ffi
Building native extensions.  This could take a while...
ERROR:  Error installing f         


        
5条回答
  •  醉梦人生
    2020-12-25 09:40

    Thanks @Tim Morris and @danv, your answers / comments helped. I adjusted for my setup, which is based more towards a superuser environment. Now this is what /usr/local/rvm/gems/ruby-1.9.2-p180/bin/rake looks like on my server:

    require 'rubygems'
    
    version = ">= 0"
    ENV['GEM_HOME']=ENV['GEM_HOME'] || "/usr/local/rvm/gems/ruby-1.9.2-p180"
    ENV['GEM_PATH']=ENV['GEM_PATH'] || "/usr/local/rvm/gems/ruby-1.9.2-p180:/usr/local/rvm/gems/ruby-1.9.2-p180@global"
    
    if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
      version = $1
      ARGV.shift
    end
    
    gem 'rake', version
    load Gem.bin_path('rake', 'rake', version)
    

提交回复
热议问题