Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install nokogiri 1.6.3 on Ruby 2.1.2 (rbenv) and OS X 10.9.4 #1130

Closed
keithpitty opened this issue Jul 21, 2014 · 33 comments
Closed

Cannot install nokogiri 1.6.3 on Ruby 2.1.2 (rbenv) and OS X 10.9.4 #1130

keithpitty opened this issue Jul 21, 2014 · 33 comments

Comments

@keithpitty
Copy link

I've spent several hours trying various suggested solutions to this problem, to no avail.

Here's the output:

$ gem install nokogiri
Building native extensions.  This could take a while...
Building nokogiri using packaged libraries.
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /Users/keithpitty/.rbenv/versions/2.1.2/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
checking for iconv.h... *** 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=/Users/keithpitty/.rbenv/versions/2.1.2/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
/Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:1067:in `block in have_header'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
    from /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/2.1.0/mkmf.rb:1066:in `have_header'
    from extconf.rb:103:in `have_iconv?'
    from extconf.rb:148:in `block (2 levels) in iconv_prefix'
    from extconf.rb:90:in `preserving_globals'
    from extconf.rb:143:in `block in iconv_prefix'
    from extconf.rb:120:in `each_iconv_idir'
    from extconf.rb:137:in `iconv_prefix'
    from extconf.rb:427:in `block in <main>'
    from extconf.rb:161:in `block in process_recipe'
    from extconf.rb:154:in `tap'
    from extconf.rb:154:in `process_recipe'
    from extconf.rb:422:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.3 for inspection.
Results logged to /Users/keithpitty/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.3/gem_make.out

And here's my mkmf.log:

"/usr/local/bin/gcc-4.2 -o conftest -I/Users/keithpitty/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0 -I/Users/keithpitty/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/backward -I/Users/keithpitty/.rbenv/versions/2.1.2/include/ruby-2.1.0 -I. -I/usr/include -I/Users/keithpitty/.rbenv/versions/2.1.2/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -Wno-error=shorten-64-to-32  -pipe  -Wno-error=unused-command-line-argument-hard-error-in-future -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c  -L. -L/Users/keithpitty/.rbenv/versions/2.1.2/lib -L/usr/lib -L. -L/Users/keithpitty/.rbenv/versions/2.1.2/lib  -fstack-protector -L/usr/local/lib     -lruby-static -framework CoreFoundation  -lpthread -lgmp -ldl -lobjc  "
cc1: error: -Werror=unused-command-line-argument-hard-error-in-future: No option -Wunused-command-line-argument-hard-error-in-future
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

I've tried the configuration options suggested at http://nokogiri.org/tutorials/installing_nokogiri.html#homebrew_09 but it doesn't change the result.

Any suggestions would be appreciated.

@cfiorini
Copy link

i had same problem, for a temporary fix you can downgrade to 1.6.2.1 that works.
looking at your mkmf.log maybe #1115 has something to do with this issue

@rmehner
Copy link

rmehner commented Jul 21, 2014

Having the same problem, even when providing the proper path to iconv, log looks like the one pasted above.

@keithpitty
Copy link
Author

@cfiorini thanks. Yes, I've locked nokogiri at 1.6.2.1 for the time being. However, we obviously need a fix. It looks like #1115 needs re-evaluating.

@tigris
Copy link

tigris commented Jul 21, 2014

Same problem here, not related to ruby 2.1.2 it seems. Probably related to OSX in general?

https://gist.github.com/tigris/83a608b978b5f18c094b is my setup and logs.

Have tried without the --use-system-libraries flag set. Have also tried with homebrew version of libiconv. None of which is required to get 1.6.2.1 installed. In fact I don't even think I needed the homebrew version of libxslt to install the older versions.

@ghost
Copy link

ghost commented Jul 21, 2014

same issue ( mavericks , rbenv w ruby 2.1.2) cannot get nokogiri-1.6.3 installed , ( no problem w 1.6.1 and 1.6.2.1) so it's definitly an issue w 1.6.3 !!!

@vanderhoorn
Copy link

Same issue on Mac OS X Lion with rvm on Ruby 1.9.3 and on Ruby 2.1.2.

@flavorjones
Copy link
Member

Have you all installed XCode on your machine? How about XCode command line
utilities? "xcode-select --install"

On Mon, Jul 21, 2014 at 10:54 AM, vanderhoorn [email protected]
wrote:

Same issue on Mac OS X Lion with rvm on Ruby 1.9.3 and on Ruby 2.1.2.


Reply to this email directly or view it on GitHub
#1130 (comment)
.

@vanderhoorn
Copy link

Yes. I even reinstalled Xcode. Didn't help.

I think @cfiorini is right, and as @knu suggests in #1115, it is probably a gcc vs. clang/lvmm issue.

@flavorjones
Copy link
Member

OK, I've pinged @zenspider ...

For the record, I'd just like to note that this code has been available as a release candidate for over a month. I'd love if people participating on this thread would commit to testing release candidates on Macs going forward.

@zenspider
Copy link
Contributor

@tigris correct me if I'm misinterpreting this data... You're showing that you have xcode-select version 2333, but then you're compiling with gcc-4.2 and you're getting a failure on the very first compiler sanity check. Does that sound right?

Any reason why you're using gcc-4.2?

@flavorjones I'm on it. Knu is prolly right in that we need to check GCC vs clang, tho I'm not entirely sure HOW at this point.

@zenspider
Copy link
Contributor

@flavorjones @vanderhoorn installing xcode doesn't matter if you don't use it. Check to see if your homebrew has gcc-4.2 installed. If you look at your mkmf.log file, you'll prolly see that you're using gcc-4.2 to compile the gem.

I don't know if this is an rvm thing, or just holdover from the between-phase when there were bugs between ruby/clang.

@zenspider
Copy link
Contributor

@vanderhoorn or @tigris can you please test against #1131 ?

@comuttun
Copy link

Hi, I'm also stuck on this issue.

My environment is Xcode 5.1.1 + Homebrew + ruby (built with ruby-build).

$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
$ ruby -e "require 'mkmf'; puts RbConfig::CONFIG['CC']"
gcc-4.2

I think ruby (at least 2.1.2) selects by default gcc-4.2 (if it is installed by Homebrew) prior to gcc provided by Xcode, so this is not problem of Xcode, Homebrew or ruby-build.

$ curl -LO http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
$ tar xf ruby-2.1.2.tar.gz
$ cd ruby-2.1.2
$ ./configure
checking build system type... x86_64-apple-darwin13.3.0
checking host system type... x86_64-apple-darwin13.3.0
checking target system type... x86_64-apple-darwin13.3.0
checking for gcc-4.2... gcc-4.2
checking for gcc... (cached) gcc-4.2

@comuttun
Copy link

I've tested #1131 on my env
https://gist.github.com/comutt/d6330c827f6f33bab604

@zenspider
Copy link
Contributor

@comutt thanks!

@flavorjones can you merge #1131? And then we'll go from there.

@flavorjones
Copy link
Member

Will do within the hour.
On Jul 21, 2014 5:59 PM, "Ryan Davis" [email protected] wrote:

@comutt https://github.com/comutt thanks!

@flavorjones https://github.com/flavorjones can you merge #1131
#1131? And then we'll go
from there.


Reply to this email directly or view it on GitHub
#1130 (comment)
.

@flavorjones
Copy link
Member

Building now ...

@tigris
Copy link

tigris commented Jul 22, 2014

@zenspider, i'm not entirely sure the reason for gcc-4.2. I assume it is due to me having apple-gcc42 homebrew package installed. No idea why I had that installed, but removing it and re-trying the nokogiri install results in make: gcc-4.2: No such file or directory. I assume that means I need to recompile ruby since I removed the gcc it was compiled with. Doing that now.

@flavorjones the xcode-select --install tool doesn't work on mavericks, see here http://stackoverflow.com/questions/19907576/xcode-is-not-currently-available-from-the-software-update-server and as such I believe the correct solution for that problem (which may not be related to this, but may want to upgrade some documentation somewhere?) is one of sudo xcode-select --switch /Library/Developer/CommandLineTools/ or sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

@flavorjones
Copy link
Member

Hi @tigris,

Thanks for the comments. Again, we're building a bugfix release that you can try right now.

As far as installing xcode commandline tools ... I'm sorry, it's possible there's some nuance I'm missing, but I've personally seen more than 5 developers use that command on Mavericks.

I'm a Linux user, so I'm possibly just lost, but I'd love if Apple Macintosh users would commit to trying out RC versions of Nokogiri. Just as an example, the commit in question here was in 1.6.3.rc2 on June 17th, and nobody raised any issues about it.

@tigris, can I count on you for testing RC versions in the future?

@tigris
Copy link

tigris commented Jul 22, 2014

@flavorjones i can try, but i don't actually use nokogiri directly. Unfortunately, much like json and yaml gems, it's become a default dependency for a lot of other things. In my case, the aws-sdk gem. I've never actually installed nokogiri manually myself, only via bundler as dependencies of other things :/

@zenspider I have confirmed that once the apple-gcc42 homebrew package is removed and ruby re-installed, then nokogiri correctly picks up /usr/bin/gcc to compile with instead of /usr/local/bin/gcc-4.2, and nokogiri 1.6.3 installs fine via that version of gcc.

Having said that, the apple-gcc42 package seems to come by default with homebrew. Every developer I've asked so far has that homebrew package installed and they didn't install it manually. Which in turn means everyone's ruby will have compiled with gcc4-2 instead of gcc.

@flavorjones
Copy link
Member

1.6.3.1 is out, please reopen this if it doesn't solve your -Werror=unused-command-line-argument-hard-error-in-future-related problem.

@keithpitty
Copy link
Author

@flavorjones thanks very much. Successfully installed.

@flavorjones
Copy link
Member

@keithpitty thanks for verifying! And thanks for using Nokogiri!

@comuttun
Copy link

@flavorjones Thank you for rapid release! 1.6.3.1 installation has succeeded.

@zenspider
Copy link
Contributor

@tigris:

10001 % xcode-select --install
xcode-select: note: install requested for command line developer tools

works fine on mavs.

That said, 1.6.3.1 should address this with either compiler.

@zenspider
Copy link
Contributor

Thanks everyone.

@tigris
Copy link

tigris commented Jul 22, 2014

Thanks @zenspider. As per the S/O link I provided, it doesn't work in all cases. I think it's dependant on fresh mavs install vs upgrade, or perhaps other things. A dialog appears and you click on INSTALL but it dies saying not available from update server.

In any case, thanks for the fix, it now compiles with the gcc-4.2 provided by homebrew's apple-gcc42 package.

I have also found that you can install many newer versions of gcc via homebrew that would also fix the problem, it's just that apple-gcc42 is installed by default for anyone that has installed homebrew but not bothered to install any other gcc packages.

@knu
Copy link
Member

knu commented Jul 22, 2014

I thought it might be better to actually test if C compiler accepts the flag than to guess from the value of CC, so I added a commit (3c3d34f) that does that. Let me know if it has any problem.

@vanderhoorn
Copy link

1.6.3.1 installs perfectly. Thanks very much for addressing this issue so quickly.

@flavorjones
Copy link
Member

Can anybody who had this original problem tell me what their value of RbConfig::MAKEFILE_CONFIG['CC'] is?

That is, how can I tell if the compiler being used is clang?

@rmehner
Copy link

rmehner commented Jul 22, 2014

RbConfig::MAKEFILE_CONFIG['CC']
=> "gcc-4.2"

@vanderhoorn
Copy link

Here "gcc-4.2" as well.

@TWCCC
Copy link

TWCCC commented Aug 14, 2014

@tigris I have the same issue and my system info like yours,
and I use xcode-select --install ,run bundle install.
It works for me! Hope this info help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants