15

ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

gem 2.0.3

sudo gem install travis Building native extensions. This could take a while... ERROR: Error installing travis: 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:4:in `<main>' Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.0 for inspection. Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.0/ext/ffi_c/gem_make.out 

Also encountering this when trying to install other gems. I'm not a Ruby user, and googling the error did not get me any working solution.

I installed Ruby 2.0 using RVM: "curl -L https://get.rvm.io | bash -s stable --ruby".

If I do "sudo ruby -v" I get "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]".

1
  • and did you read the error log? Commented Aug 9, 2013 at 13:55

4 Answers 4

23

It looks like you're using Ruby 1.9.1 installed via the system. In order to fix that error, you should install the ruby-dev package.

In Debian/Ubuntu,

sudo apt-get install ruby1.9.1-dev.

Since the gem uses native extensions, you should also do a

sudo apt-get install build-essentials

before that.

However, I would strongly recommend using RVM and using the RVM ruby, since it pulls all most of the dev dependencies for your system and you don't have native extension problems so often.

Sign up to request clarification or add additional context in comments.

4 Comments

I did use RVM. Updated the question.
Installing ruby1.9.1-dev fixed my problem.
If I try to install build-essentials, it is not found. I just found build-essential
I'm running Ubuntu 16.04 with Ruby 2.3. sudo apt-get install ruby-dev did the trick for me. I'm not finding any build-essentials package, but I don't seem to need either.
3

On a Mac (El Capitan) I had to:

xcode-select --install

then

sudo gem install -n /usr/local/bin travis

Comments

2

You can install the travis gem with this hack:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install travis 

if you need more permission put sudo in the beginning.

Explanation here: Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'

Comments

1

First, I don't know how you installed Ruby2.0, but the error show that you're still using 1.9.1. Probably you should call 'gem' using the complete path to where you installed Ruby2.0.

Also, gem refuses to install the component because it needs to compile native code : you will need the Ruby headers (ruby-dev package), but also probably make, gcc, ...

Don't hesitate to tell us a bit more about your ruby2.0 installation.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.