Error installing nokogiri due to native extension

534 views
Skip to first unread message

Adam Lopez

unread,
Jan 24, 2016, 2:08:16 AM1/24/16
to nokogiri-talk

I have come across this issue when trying to install nokogiri that says:

ERROR: Failed to build gem native extension.


    /usr/local/opt/ruby/bin/ruby -r ./siteconf20160124-576-1thdgdd.rb extconf.rb

checking if the C compiler accepts ... *** 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

--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=/usr/local/Cellar/ruby/2.2.3/bin/$(RUBY_BASE_NAME)

--help

--clean

/usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)

You have to install development tools first.

from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'

from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'

from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'

from extconf.rb:80:in `nokogiri_try_compile'

from extconf.rb:87:in `block in add_cflags'

from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'

from extconf.rb:86:in `add_cflags'

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


extconf failed, exit code 1


Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7.2 for inspection.

Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nokogiri-1.6.7.2/gem_make.out


I don't know how to make sense of what to do next... I've tried this command:


gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/


but still came across the same error.  


Please help me!

Mike Dalessio

unread,
Jan 24, 2016, 2:12:00 AM1/24/16
to nokogiri-talk
Hi,

This line:

    You have to install development tools first.

tells me that you don't have the utilities necessary to compile C extensions.

Please make sure you've got xcode installed. If you think you do have everything installed, then please provide more information about your system, including:

* how you installed and compiled ruby
* the version of xcode
* the contents of /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0/nokogiri-1.6.7.2/gem_make.out

-m


--
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.

Jack Burum

unread,
Feb 1, 2016, 9:00:54 PM2/1/16
to nokogiri-talk
Hey Adam,

I just wanted to let you know that I had the same problem and solved it by opening my xcode application and accepting the new terms. Then I just went back in and ran bundle and the issue was fixed. Just wanted to let you know in case this might help the issue you have here.

- JB

Mike Dalessio

unread,
Feb 2, 2016, 2:48:30 PM2/2/16
to nokogiri-talk
Worth noting that the Installation Tutorial here:

http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

documents how to do that from the commandline:

sudo defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL

which at least worked on a recent XCode release. YMMV, as usual.


--
Reply all
Reply to author
Forward
0 new messages