-
-
Notifications
You must be signed in to change notification settings - Fork 904
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
Nokogiri error: Libiconv missing on mavericks #1111
Comments
@knu are you able to investigate this? Or should we hand off to a Mac user? ;) |
Looking... |
It installs fine for me using stock ruby on OSX 10.9.3:
What I need from you:
|
Also, what's logged in mkmf.log is essential for further investigation. Please locate it and paste it (in Gist if it's huge). |
Mac OS X 10.9.3 build 13D65 libiconv 1.14 Rubygems 2.2.2 The same problem when install nokogiri v '1.6.2.1'. |
I can't install either (Yosemite - Xcode 6 Beta as command line tools) without some parameter ( Also tried with This worked: $ brew reinstall libiconv libxml2 libxslt
==> Reinstalling libiconv
==> Downloading http://ftpmirror.gnu.org/libiconv/libiconv-1.14.tar.gz
######################################################################## 100.0%
==> Downloading https://trac.macports.org/export/89276/trunk/dports/textproc/libiconv/files/patch-Makefile.devel
######################################################################## 100.0%
==> Downloading https://trac.macports.org/export/89276/trunk/dports/textproc/libiconv/files/patch-utf8mac.diff
######################################################################## 100.0%
==> Patching
patching file Makefile.devel
Hunk #1 succeeded at 106 (offset 1 line).
patching file lib/converters.h
patching file lib/encodings.def
patching file lib/utf8mac.h
patching file lib/flags.h
==> ./configure --prefix=/usr/local/Cellar/libiconv/1.14 --enable-extra-encodings
==> make -f Makefile.devel CFLAGS= CC=clang
==> make install
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/libiconv/lib
CPPFLAGS: -I/usr/local/opt/libiconv/include
==> Summary
/usr/local/Cellar/libiconv/1.14: 26 files, 1.4M, built in 76 seconds
==> Reinstalling libxml2
==> Downloading ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/libxml2-2.9.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/libxml2/2.9.1 --without-python
==> make
==> make install
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/libxml2/lib
CPPFLAGS: -I/usr/local/opt/libxml2/include
==> Summary
/usr/local/Cellar/libxml2/2.9.1: 274 files, 11M, built in 40 seconds
==> Reinstalling libxslt
==> Downloading ftp://xmlsoft.org/libxml2/libxslt-1.1.28.tar.gz
Already downloaded: /Library/Caches/Homebrew/libxslt-1.1.28.tar.gz
==> ./configure --prefix=/usr/local/Cellar/libxslt/1.1.28 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.9.1
==> make
==> make install
==> Caveats
To allow the nokogiri gem to link against this libxslt run:
gem install nokogiri -- --with-xslt-dir=/usr/local/opt/libxslt
This formula is keg-only, so it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/libxslt/lib
CPPFLAGS: -I/usr/local/opt/libxslt/include
==> Summary
/usr/local/Cellar/libxslt/1.1.28: 134 files, 3.1M, built in 25 seconds $ 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/kain/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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=/Users/kain/.rvm/rubies/ruby-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
extconf failed, exit code 1
Gem files will remain installed in /Users/kain/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/kain/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-14/2.1.0/nokogiri-1.6.2.1/gem_make.out |
I was able to work around this by following the suggestion here http://stackoverflow.com/questions/22352838/ruby-gem-install-json-fails-on-mavericks-and-xcode-5-1-unknown-argument-mul I've noticed this error on multiple Macs that were upgraded to 10.9.3 and haven't seen it on Macs that begin their lives on 10.9.3 (with only the XCode CLI tools installed). I'm running XCode 5.1.1 (5B1008) on the Mac that experienced the issue. The specific command that ultimately worked to install Nokogiri under system ruby was:
|
@hiremaga Is spot on I think on the new OS X that begin their lives on Mavericks. I got a new Macbook Air, and I installed Nokogiri without any issues. But when I restored my old Macbook Pro, I wasn't able to install Nokogiri without specifying some hackish paths to libiconv. What can we do to help pin down this? |
@allaire don't think so. My macbook air started as 10.8 and has since been upgraded to 10.9 and I don't have problems installing. I did find a problem installing on a virginal OSX 10.9 that I'm tracking down, but it is unrelated to this and looks like it might be a problem with rubygems or some-such. I need a repro to get further with this. Preferably a repro without rvm. If it requires rvm to repro, then it is a problem with rvm. @masterkain -- you need to follow the instructions that brew is giving you. It is very specifically spelling out:
|
@zenspider If that helps, the laptop that install failed was running with rbenv, not rvm. Thanks for taking the time to figure this! |
OK. I'll install ruby-build and take a whack at that tomorrow. |
Fwiw, the machines I've seen this on started off as 10.9 (2.0.0p247 system I'll write back of I get the opportunity to replicate this reliably in a VM. On Monday, June 23, 2014, Ryan Davis [email protected] wrote:
|
@masterkain When you used the libiconv formula, was that something that you wrote yourself? It seems like the libiconv formula that used to be distributed with Homebrew was removed in commit ad7020 |
@masterkain Or maybe you were using the homebrew/dupes? |
the same issue, can not install it. the troubleshooting page http://nokogiri.org/tutorials/installing_nokogiri.html shows already to use hombebrew - it should be updated.
|
FYI: i got it installed with this:
it looks like that the error message is wrong for the libiconv - it better should check before if the xcode command line tools are installed |
Nothing I did helped. I have installed all the libraries and supplied every command line argument I have found on StackOverflow and Github:
|
@firedev did you see:
Have you ensured that you have the cmdlline tools installed? As @muescha points out, you might have to run:
|
Sure thing:
Everything works except |
I don't see an
|
|
On Jul 3, 2014, at 4:52, Nick Ostrovsky [email protected] wrote:
gcc-4.2 is a homebrew recipe. It hasn't been shipped by apple in ages. Can you verify that it is in /usr/local/bin (or wherever your homebrew is) and then unlink it and try again? |
I have uninstalled
|
Because the ruby you're installing with was compiled with it. Try with your stock ruby or rebuild your rbenv version.
|
@zenspider Thank you! I was pulling my hair out already. |
On Jul 4, 2014, at 1:11, Nick Ostrovsky [email protected] wrote:
Does that mean it worked for you? If so, can you write up a summary of what you needed to do/change to get going? That will help me get it into the guide. |
Basically something like this:
That also fixed an issue with |
My setup is like @dmitrytrager and like @firedev I have tried every single solution known to Man. The only work-around I have for now is to install 1.6.1 rather than the latest (1.6.2). The mkmf.log output suggests that the number of arguments to the iconv_open() function is incorrect. See this related issue in another project, rails-sqlserver/tiny_tds#104 , and this rather old but still relevant discussion, https://www.ruby-forum.com/topic/1354865 . Thanks for looking at this. |
This worked for me: You need to uninstall nokogiri (if installed with brew paths or anything like that), install build tools from apple: |
I have two Macs. One has the problem of the OP, with nokogiri 1.6.2 and 1.6.3. The other... does not. The difference? The one that works, has had this command applied: bundle config build.nokogiri --with-iconv-include=/opt/local/include Because I've built a version of libiconv from source and put it in /opt/local. If I replace the /opt/local/include with /usr/include, I get the failures of the OP again. Note that the Mac does have /usr/lib/libiconv.2.dylib and that a "nm" of this library suggest that iconv_open is a recognised symbol. Without digging into the compilation system a little deeper, I don't really know what's going wrong. But I have a workround that works enough for development. I wouldn't be deploying on a Mac, so if it works in dev, with no testing errors trackable to it... it works well enough. I'm still curious as to why the Apple supplied include file and library aren't usable. That's just my monkey curiousity (en_gb), though. :) |
Bah. Answers involving 'bundler' are, of course, only sanely useful for ruby based problems. Slight further digging suggests that some software doesn't like Apple's libiconv, because it offers iconv_open, not libiconv_open. That seems a pretty odd problem It'd be fairly easy, surely, to write a wrapper function that just calls the Apple functions? Personally I'd rather install a lightweight shroud around a system resource, than have to maintain yet another 3rd party resource. |
A coworker was also having a problem where the error text suggested it couldn't find iconv, and running |
Here's a gist of the mkmf.log and some notes on various attempts to use xcode-select: https://gist.github.com/JezC/aee8e41bddac27d78ce7#file-gistfile1-txt |
I'll throw in here that I was having this issue as well on a fairly clean install of Mavericks (10.9.4) and Xcode 5.1.1. I got no errors about missing command line tools, but |
Mhh
|
@muescha - the XCode workaround is only necessary on OSX Mavericks. Do you have virtual servers running Mavericks? If not, can you please explain what you are trying to accomplish, and what the problem you're encountering is? |
I have one virtual server (@dreamhost) with an old version of nokogiri and now i fear to upgrade it when it makes this lot of trouble on my local dev osx. |
@muescha - the issue appears restricted to OS X. I have several Linux VMs @nike_delassio - I think the issue may be something to do with having On Mon, Jul 28, 2014 at 9:10 PM, muescha [email protected] wrote:
Jeremy Chatfield - |
@JezC thx - i think this should better described in the install section. Maybe also some small one line script where i can check the requirements |
|
I did a fresh install of OS X 10.9.4 (technically, Mountain Lion, then immediately upgraded to Mavericks - just because I had a Mountain Lion USB stick to hand). Installed Xcode 5.1.1, and ran it, accepting license and updating downloads in the Preferences. It has command line tools built in. Tried to build, and it fails saying that "package configuration for libiconv is not found". Ran 'xcode-select --install' and accepted the pop up window. Retried the installation, and it completes. Looks to me like part of the problem is installing brew, probably trying to handle the libx* issues, or as in my case, becaue I had other projects that used brew components. That residue of other projects probably then creates include files on the path that override the iconv_open name to libiconv_open - which the system libs can't satisfy. You then end up having to install libiconv as well, just to get the renamed function to be found... Put more simply, if your system is plain, then 'xcode-select --install' probably works. If you have touched brew (or macports, too, probably), then you may be at risk of inadvertently renaming the needed function call, to something that the install process can't understand and use. You end up installing GNU libiconv to satisfy the need for libiconv_open, instead of using the system iconv. I'm now planning to taint the Mac Mini I'm using for this, so that I can probe what causes the build to fail when xcode is installed and potentially able to work, such that one needs to install GNU iconv to make nokogiri work. Because that's where I spent a lot of time - struggling with a compiler that worked, and an iconv that should have compiled and wouldn't. My suspicion is that once you use brew or macports, even for another project, you're then committed to eventually installing GNU iconv. |
👍 for |
I had a similar experience as @kchasel. No Xcode errors, but running 'xcode-select --install' seemed to fix the issue. |
Check it out, and please feel free to contribute--maybe we can boil this down to one script to fix them all! |
I had the exact same problem and my issue turned out to be an incorrect Xcode path. I had two versions of Xcode installed, and xcode-select was still configured to use an older version. Fixing this allowed me to install without issue. |
xcode-select --install did the trick |
@flavorjones I'm updating the tutorial's install guide. I think this issue can be closed. |
xcode-select --install doesn't fix the problem for me.
|
On a fresh install of Mavericks with XCode 6, xcode-select --install did fix the issue for me. |
I'm getting an almost identical issue on OpenBSD-current:
Details:
Is this the same issue? |
@hobarrera I don't think so. Please file a new issue. |
@zenspider: Ok, will do. It just seemed that it might have been a related issue. |
I believe the installation tutorial is correctly capturing an installation procedure for OSX: If I'm mistaken, please let me know and I'll reopen. |
Please help me how can I fix the error I have pasted below: Building native extensions. This could take a while...
checking for Ruby version >= 1.8.5... yes Tue 28Jul15 19:28:40 Ruby 2.0.0 (universal.x86_64-darwin14) and ImageMagickmake "DESTDIR=" clean make "DESTDIR=" make failed, exit code 2 Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/rmagick-2.13.4 for inspection. |
I am trying to install nokogiri on maverick and i am unable to do so, even when libiconv is installed through brew:
The text was updated successfully, but these errors were encountered: