ERROR: Failed to build gem native extension when installing Rails 4.2.4. Says it "Could not find 'mini_portile2'"

2,180 views
Skip to first unread message

ma...@orussa.com

unread,
Feb 16, 2016, 1:55:44 PM2/16/16
to nokogiri-talk
I'm on CentOS 7 with a cPanel installation. I've have rbenv installed with Ruby 2.2.4 and I'm getting an error trying to install Rails 4.2.4. Here's the output:

gem install rails -v 4.2.4

 

Fetching: activesupport-4.2.4.gem (100%)

Successfully installed activesupport-4.2.4

Building native extensions.  This could take a while...

ERROR
:  Error installing rails:

 ERROR
: Failed to build gem native extension.


 

    current directory
: /home/kuronekocon/ruby/gems/gems/nokogiri-1.6.7.2/ext/nokogiri

/home/kuronekocon/.rbenv/versions/2.2.4/bin/ruby -r ./siteconf20160216-1901-h26lhv.rb extconf.rb

checking
if the C compiler accepts ... yes

Building nokogiri using packaged libraries.

*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries
and/or headers.  Check the mkmf.log file for more details.  You may

need configuration options
.


 

Provided configuration options:

 
--with-opt-dir

 
--without-opt-dir

 
--with-opt-include

 
--without-opt-include=${opt-dir}/include

 
--with-opt-lib

 
--without-opt-lib=${opt-dir}/lib

 
--with-make-prog

 
--without-make-prog

 
--srcdir=.

 
--curdir

 
--ruby=/home/kuronekocon/.rbenv/versions/2.2.4/bin/$(RUBY_BASE_NAME)

 
--help

 
--clean

 
--use-system-libraries

/home/kuronekocon/.rbenv/versions/2.2.4/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'mini_portile2' (~> 2.0.0.rc2) among 9 total gem(s) (Gem::LoadError)

Checked in 'GEM_PATH=/home/kuronekocon/.gem/ruby/2.2.0:/home/kuronekocon/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0', execute `
gem env` for more information

 from /home/kuronekocon/.rbenv/versions/2.2.4/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:328:in `
to_spec'

 from /home/kuronekocon/.rbenv/versions/2.2.4/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'


 
from extconf.rb:396:in `<main>'


 

To see why this extension failed to compile, please check the mkmf.log which can be found here:


 

  /home/kuronekocon/ruby/gems/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.7.2/mkmf.log


 

extconf failed, exit code 1


 

Gem files will remain installed in /home/kuronekocon/ruby/gems/gems/nokogiri-1.6.7.2 for inspection.

Results logged to /home/kuronekocon/ruby/gems/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.7.2/gem_make.out



Running gem list looks like 

gem list

 


 

*** LOCAL GEMS ***


 

actionmailer
(4.2.5.1)

actionpack
(4.2.5.1)

actionview
(4.2.5.1)

activejob
(4.2.5.1)

activemodel
(4.2.5.1)

activerecord
(4.2.5.1)

activesupport
(4.2.5.1, 4.2.5, 4.2.4)

arel
(7.0.0, 6.0.3)

bigdecimal
(1.2.7, 1.2.6)

builder
(3.2.2)

bundler
(1.11.2)

concurrent
-ruby (1.0.0)

erubis
(2.7.0)

globalid
(0.3.6)

i18n
(0.7.0)

io
-console (0.4.5, 0.4.3)

json
(1.8.3, 1.8.1)

loofah
(2.0.3)

mail
(2.6.3)

mime
-types (3.0, 2.99)

mime
-types-data (3.2015.1120)

mini_portile2
(2.1.0, 2.0.0)

minitest
(5.8.4)

psych
(2.0.17, 2.0.8)

rack
(1.6.4)

rack
-test (0.6.3)

rails
(4.2.5.1)

rails
-deprecated_sanitizer (1.0.3)

rails
-dom-testing (1.0.7)

rails
-html-sanitizer (1.0.3)

railties
(4.2.5.1)

rake
(10.5.0, 10.4.2)

rdoc
(4.2.2, 4.2.0)

rubygems
-update (2.5.2)

sprockets
(3.5.2)

sprockets
-rails (3.0.1)

thor
(0.19.1)

thread_safe
(0.3.5)

tzinfo
(1.2.2)



So it looks like I have mini_portile2 installed, but Nokogiri can't find it?


I've tried installing different versions of Ruby (2.3.0) and Rails (4.2.5), but I get the same error. I was able to install Rails under another domain/user account on the same VPS server at the beginning of the year. Perhaps I need specific versions to install properly?


Mark O.

Mike Dalessio

unread,
Feb 16, 2016, 1:59:22 PM2/16/16
to nokogiri-talk
Hi,

Thanks for asking this question. I'd recommend you *uninstall* mini_portile2 v2.1.0 and see what happens.

The longer story here is that rubygems only enforces version checks at runtime, not at installation time, and mini_portile2 is an installation-time dependency.

Bundler would help with this, but it doesn't look like you're using Bundler.


--
You received this message because you are subscribed to the Google Groups "nokogiri-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nokogiri-tal...@googlegroups.com.
To post to this group, send email to nokogi...@googlegroups.com.
Visit this group at https://groups.google.com/group/nokogiri-talk.
For more options, visit https://groups.google.com/d/optout.

ma...@orussa.com

unread,
Feb 16, 2016, 3:15:57 PM2/16/16
to nokogiri-talk
I meant to use bundler. I'm trying to have a fairly simple and common Rails installation.

After uninstalling the mini_portile2 gem I get the same error. It just re-installs mini_portile2 and fails in the same place. I'll probably start over with rbenv if this isn't working.

gem install rails -v 4.2.5

 

Fetching: activesupport-4.2.5.gem (100%)

Successfully installed activesupport-4.2.5

Fetching: mini_portile2-2.0.0.gem (100%)

Successfully installed mini_portile2-2.0.0

Building native extensions.  This could take a while...

ERROR
:  Error installing rails:

 ERROR
: Failed to build gem native extension.


 

    current directory
: /home/kuronekocon/ruby/gems/gems/nokogiri-1.6.7.2/ext/nokogiri

/home/kuronekocon/.rbenv/versions/2.2.4/bin/ruby -r ./siteconf20160216-29213-16t7m33.rb extconf.rb

checking
if the C compiler accepts ... yes

Mike Dalessio

unread,
Feb 16, 2016, 7:34:44 PM2/16/16
to nokogiri-talk
OK, just to make sure we're communicating well with each other ...

In your original post, you showed that you have both mini_portile2 v2.0.0 and v2.1.0 installed. The error message shown is consistent with v2.1.0 being used, instead of v2.0.0.

Can you please confirm that you uninstalled *both* v2.0.0 and v2.1.0 before proceeding?

If so, can you please provide the contents of your `mkmf.log` file?


--

ma...@orussa.com

unread,
Feb 17, 2016, 12:11:22 AM2/17/16
to nokogiri-talk
Thank you for being very specific. I ran

gem uninstall mini_portile2

which removed all versions:
kuronekocon@kuronekocon.com [~]# gem list

*** LOCAL GEMS ***
actionmailer
(4.2.5.1)
actionpack
(4.2.5.1)
actionview
(4.2.5.1)
activejob
(4.2.5.1)
activemodel
(4.2.5.1)
activerecord
(4.2.5.1)

activesupport
(4.2.5.1, 4.2.5)
arel
(7.0.0, 6.0.3)
bigdecimal
(1.2.7, 1.2.6)
builder
(3.2.2)
bundler
(1.11.2)
concurrent
-ruby (1.0.0)
erubis
(2.7.0)
globalid
(0.3.6)
i18n
(0.7.0)
io
-console (0.4.5, 0.4.3)
json
(1.8.3, 1.8.1)
loofah
(2.0.3)
mail
(2.6.3)
mime
-types (3.0, 2.99)
mime
-types-data (3.2015.1120)
minitest
(5.8.4)
psych
(2.0.17, 2.0.8)
rack
(1.6.4)
rack
-test (0.6.3)
rails
(4.2.5.1)
rails
-deprecated_sanitizer (1.0.3)
rails
-dom-testing (1.0.7)
rails
-html-sanitizer (1.0.3)
railties
(4.2.5.1)
rake
(10.5.0, 10.4.2)
rdoc
(4.2.2, 4.2.0)
rubygems
-update (2.5.2)
sprockets
(3.5.2)
sprockets
-rails (3.0.1)
thor
(0.19.1)
thread_safe
(0.3.5)
tzinfo
(1.2.2)

So after uninstalling mini_portile2 I installed bundler:
kuronekocon@kuronekocon.com [~]# gem install bundler
Successfully installed bundler-1.11.2
1 gem installed

Following the rbenv documentation I should check the location of where gems are being installed:
kuronekocon@kuronekocon.com [~]# gem env home
/home/kuronekocon/ruby/gems

I noticed this doesn't match the example given in the docs: # => ~/.rbenv/versions/<ruby-version>/lib/ruby/gems/...

Should my gem location be inside the .rbenv directory? Is this a potential source of errors and something I need to figure out before continuing?

Mark O.
Reply all
Reply to author
Forward
0 new messages