简体   繁体   中英

Installing Ruby Gem on Raspbian Error: Failed to Build Gem Native Extension

I'm trying to install a ruby gem ( Jekyll ) and I keep getting the following error.

ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb
    /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:1:in `<main>'

I'm using a Raspberry Pi. When asking Ruby it's version, I get the following:

user@raspberrypi ~ $ ruby -version 
ruby 1.9.3p194 (2012-04-20 revision 35410) [arm-linux-eabihf]
-e:1:in `<main>': undefined local variable or method `rsion' for main:Object (NameError)

A few hours ago, I installed the latest version of Ruby by running the command:

sudo curl -L https://get.rvm.io | bash -s stable --ruby

To find out the source of the problem I tried installing a different gem ( lolcat ). It installed successfully and works perfectly.

What am I doing wrong?

Thank you in advance!

So, I've looked into other questions on StackOverflow here and here , and I found out it was because of the version of Ruby that I had. Even if I installed the latest RVM, I had to install the correct version of Ruby by running the command:

sudo apt-get install ruby1.9.1-dev

Solved my problem. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM