-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
libiconv is missing #442
Comments
I asked this same question, and was given this response: Install MacPorts: http://www.macports.org |
I was having the same issues on 10.6. I re-installed MacPorts, port installed libxml2 and libxslt again and now I'm no longer experiencing these issues. |
Assuming you installed libxml2 and libxslt with MacPorts, then you might still be getting this error due to a mismatch of the order of include paths and link paths used by the call to have_func('iconv_open', 'iconv.h') Simple (patch) solution: delete libiconv.* in /usr/local/lib Suggestion: have extconf.rb perform slightly more sophisticated checking of what iconv libs are actually installed, and give the user a better clue. In this case libiconv is NOT missing. There's actually TWO libiconvs, the correct header was being compiled, and an old library was being linked. Seems like a very common problem that the install file error message could give a little more help with. |
And I think this might be an issue with mkmf and the way it handles library paths? The failing compile check for me was:
Note the compile stage starts with /opt/local/include, but the link stage starts with /usr/local/lib, which is where the old version was
|
I'm using Lion and homebrew. For me, this did the trick:
|
In my case (Migration to OS X Lion), to fixe the problem, I cleaned macports : port -qv installed > myports.txt
sudo port -fp uninstall --follow-dependents installed
sudo port clean all More details : http://trac.macports.org/wiki/Migration |
+1 to what jfahrenkrug said. The installation guide on http://nokogiri.org/tutorials/installing_nokogiri.html, homebrew section should probably be updated; brew install libxml2 libxslt to brew install libxml2 libxslt libiconv |
jfahrenkrug's fix also worked for me |
+1 works for me |
I've followed the instructions to build libxml2 and libxslt from brew. I can't build nokogiri. I get an error when I try 'brew install libiconv': $ brew install libiconv I'm on a fresh Snow Leopard install. I'd rather not use MacPorts. Please help. |
@jseigler I'm running brew 0.8.1 and I can install libiconv with no problem. Try upgrading brew? |
I had the same issue as @jseigler. I'm running brew 0.9 on OS X 10.7.3. Downloading libiconv and compiling manually worked. |
If you figure out how to install Nokogiri against brew 0.9 libraries, please let me know -- I'll update installation documentation. In the meantime, though, as a user primarily of Linux, I'm afraid I can't be of much help. @tenderlove, any ideas? You <3 macs. :) :) :) |
Using brew 0.9 on OSX 10.7.3 the following worked: brew install libxml2 libxslt Install libiconv from source: Then install nokogiri: |
@ brennenf Nice work. That did it for me too. |
Instructions posted to nokogiri.org: http://nokogiri.org/tutorials/installing_nokogiri.html#homebrew_09 Thanks, everybody. |
@brennenf Thanks for this line |
@brennenf your fix gets me a nice "Successfully installed nokogiri-1.5.2" but when I run bundle install in my rails app it still fails on: "An error occured while installing nokogiri (1.5.2), and Bundler cannot continue. |
@ttringas - please email nokogiri-talk. this issue is regarding nokogiri 1.4.4 and has been closed for months. |
Hi any updates on Mountain Lion ? I've updated the path mentioned on nokogiri installation page :
this is what i've in return: https://gist.github.com/3186643 |
@polarblau look who has problems now :D (me) |
It might help but it seems the RVM "ecosystem" seems buggy after updating to mountain lion. I remove the .rvm and install rvm using http://unfiniti.com/software/mac/jewelrybox/ and now it works but I have a warning that says: |
Same here, reinstalling ruby did the trick (i'm not really surprised - that's pretty common pitfall) |
@pietia ;) et al. Some ideas over at SO, FYI — http://stackoverflow.com/questions/5528839/installing-nokogiri-fails-libiconv-missing . |
@polarblau, to late! i've read that already ;) |
To get the installation working on my newly upgraded Mountain Lion I had to remove my previously installed rvm packages (located in $rvm_path/usr), rebuild ruby 1.9.3, and then gem install nokogiri succeeded. See https://rvm.io/packages/ |
I'm on Mountain Lion. Reinstalling Ruby worked for me. |
checking for libxml/parser.h... nolibxml2 is missing. I found one extra step was required to solve the above for Homebrew 0.9 on Mac OS X 10.8 Mountain Lion and that is to create a "/usr/bin/gcc-4.2" link: brew install libxml2 libxslt |
brax4444 thanks so much, you are a life saver!! Worked perfectly with the addition of a sudo on your last command because of the error: ERROR: While executing gem ... (Errno::EPERM) |
@lamont-granquist This is a bit out of my depth now. How can we know libiconv.dylib is damaged?
|
Yeah, that looks fine, this is mine:
What about |
@lamont-granquist
iconv.h files are just these two:
|
Nope that's all cool. As far as I can see you should be able to 'gem install nokogiri' without any other arguments.... |
Just wanted to add that |
@lamont-granquist Yes, |
OS X 10.9.4 Mavericks. $ gem install nokogiri
Building nokogiri using packaged libraries. Provided configuration options: 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:423:in '
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/nokogiri-1.6.3.1 for inspection. |
validate you have these files: % ls -la /usr/include/iconv.h
-rw-r--r-- 1 root wheel 7981 Jul 29 15:32 /usr/include/iconv.h
% ls -la /usr/lib/libiconv.*
lrwxr-xr-x 1 root wheel 16 Feb 26 2014 /usr/lib/libiconv.2.4.0.dylib@ -> libiconv.2.dylib
-r-xr-xr-x 1 root wheel 2088992 Feb 26 2014 /usr/lib/libiconv.2.dylib*
lrwxr-xr-x 1 root wheel 20 Feb 26 2014 /usr/lib/libiconv.dylib@ -> libiconv.2.4.0.dylib if you don't, use then if you use homebrew, update your homebrew and brew update
brew tap homebrew/dupes
brew uninstall libiconv
brew unlink libiconv
brew install libiconv validate that you do not have /usr/local/include/iconv.h: % ls -la /usr/local/include/iconv.h
ls: /usr/local/include/iconv.h: No such file or directory also validate that you do not have /opt/local/include/iconv.h % ls -la /opt/local/include/iconv.h
ls: /opt/local/include/iconv.h: No such file or directory if you do have that file then you've got iconv installed from macports, ideally you would get rid of this. then try: gem install nokogiri
gem install nokogiri -- --with-iconv-dir=/usr
gem install nokogiri -- --with-iconv-dir=/usr/local/opt/libiconv
gem install nokogiri -- --with-iconv-dir=/opt/local (stop when you find the one that works) if all else fails: brew link --force libiconv
gem install nokogiri -- --with-iconv-dir=/usr/local something in there should work. |
@lamont-granquist Thanks for your instruction, I'm getting what is going on and have started working on a fix. However I'm still unable to reproduce the problem on any of my Macs so there's no way to confirm if a fix works. Can you possibly provide the steps for reproduction? |
Well, I've had this MBP for 3 years and after 2 OS upgrades and at least 3 TM restores, my /usr/include/iconv.h had disappeared somehow. So nuke'ing that file can cause the problem. The solution is to re-install xcode and the command line tools properly. Also, while debugging this one thing people suggest doing is to 'brew link libiconv --force' so that it is installed into /usr/local/include/iconv.h -- even though there's huge warnings when you do 'brew install libiconv' and 'brew link libiconv' that this is a bad idea. The problem there is that you can pick up that iconv.h while picking up the system /usr/lib/libiconv.dylib and that has a conflict right away over iconv_open() vs libiconv_open() and fails to compile because they're different versions. I'm not sure there's anything to fix in those cases. The problem is really with mangling your operating system and needing to back it out to a more pristine shape. There is one thing I don't understand which is why nokogiri's build system will find MacPorts-installed /opt/local/include/iconv.h files. I don't use MacPorts so haven't debugged that, but its causing similar problems to when homebrew has iconv.h linked directly into /usr/local/include. If nokogiri could be made to stop doing that, it would help with people who have libiconv installed from MacPorts. |
$ ls -la /usr/include/iconv.h -rw-r--r-- 1 root wheel 7981 Sep 11 11:32 /usr/include/iconv.h ls -la /usr/lib/libiconv.* brew update $ brew tap homebrew/dupes $ brew uninstall libiconv Uninstalling /usr/local/Cellar/libiconv/1.13.1... Error: Permission denied - /usr/local/Cellar/libiconv/1.13.1/bin/iconv it's giving me Permission error on that step |
you need to fix all your permissions under /usr/local whatever your login is you need to fix the perms so root does not own homebrew files under /usr/local: my username is 'lamont' which i can find with the % id -nu
lamont to fix perms, i would do: % sudo chown -R lamont /usr/local you want to be real careful with that command, though, and double check that you've spelled everything correctly and gotten the right username. |
@lamont-granquist Doesn't the libiconv package of Homebrew install /usr/local/lib/libiconv.dylib while putting /usr/local/include/iconv.h? What I don't understand is if /usr/local/include/iconv.h is picked up why /usr/local/lib/libiconv.dylib isn't when linking. Usually when -I/usr/local/include is in CPPFLAGS -L/usr/local/lib should be in LDFLAGS. As for the environmental breakage, Nokogiri could at least suggest (re)installing Command Line Tools when /usr/include/iconv.h is missing on OS X. |
brew unlink libiconv I ignored message and followed next steps. No success |
@knu yeah, i looked into that and i think i got lost in the twisty maze of mkmf.rb. |
@Ilovebarca |
@lamont-granquist |
I'm going to make some changes in the iconv detection process and added a check for missing /usr/include/iconv.h on OS X to extconf.rb. Here's a work in progress, and testers are welcome! |
I've been going through github issues, stack exchange, google etc and the only thing that has worked so far has been @lamont-granquist suggestion. Setup using: OSX 10.9.5 |
I understand so many people somehow get their OS X environment broken and they don't even notice that. One problem is missing Xcode Command Line Tools and the other is Homebrew. The next release of nokogiri will try to detect such a breakage before entering the build and warn user of it. Thanks for your support! |
Thanks @lamont-granquist, I've been struggling this problem for a week now and finally your solution of reinstalling back libiconv works...that's a relief!!! |
@jomz works on osx 10.10. thanks 👍 |
From a fresh install of 10.10 just today:
This installed ruby version 2.1.5p273 and nokogiri 1.6.4.1. Presumably you could force the install of these versions via homebrew and rubygems. From a 10.10 install upgraded from 10.9 with homebrew and ruby already installed:
I'm not sure it was necessary to re/install libxml2 and/or libxslt, but this did the trick for me. |
I believe we've captured this in the updated installation tutorial here: If not, please let me know and I'll reopen. |
Thanks for the tutorial link! It worked for me when I specified the file paths, as described in "Using Nonstandard libxml2 / libxslt installations." (Seems /usr/bin in OS X 10.6.8 is considered a nonstandard location for system libraries.) To find the file paths, I used the Terminal commands |
adding step to use gcc-4.2 when installing nokogiri with homebrew 0.9 and osx mountain lion, as reported by brax444 (sparklemotion/nokogiri#442 (comment))
We're running Ruby 1.8.7 (through RVM) on OS X 10.6.6. Trying to install nokogiri 1.4.4 using bundler results always the following error:
Following the instructions here in the wiki as well as around the net we've used MacPorts to install
libxml2
andlibxslt
, which results in the following situation:We've build
libxml2
andlibxslt
from source and tried both to install the gem with the flags for the MacPorts and the build as described in the wiki as well as a few variations found online. — The results remains the same. We've even downloaded the gem, changedextconf.rb
as suggested here: https://github.com/tenderlove/nokogiri/issues#issue/381, and compiled it locally but the final outcome is the same.What are we missing? We're pretty much stuck with this situation.
The text was updated successfully, but these errors were encountered: