Install Nokogiri 1.6.1 under Ruby 2.0.0p353 (rvm based installation) fails (OSX Mavericks)?

后端 未结 5 1126
终归单人心
终归单人心 2020-12-19 06:51

I\'ve tried to install Nokogiri 1.6.1 under Ruby and RVM but is failing with the following error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build         


        
5条回答
  •  庸人自扰
    2020-12-19 07:27

    manually ./configure 'include' and 'lib' locations helped me out. libxml2 source layout is a bit strange, so i ended up with alike options:

    gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib

    of course, version numbers depend upon what is actually installed. at the time of this writing there version were in the brew.

    in my case /usr/local/Cellar/libxml2/2.9.1/include/libxml2 contains a single directory named libxml and /usr/local/Cellar/libxml2/2.9.1/lib contains libxml2.2.dylib libxml2.a libxml2.dylib pkgconfig xml2Conf.sh: these are what the script is looking for, no other combination made it compile using system libraries.

    using homebrew nokogiri can be installed with neither outdated nor incompatible (recent) libxml2 and libxslt libraries as pointed out in this gist. working fine and fast for me.

提交回复
热议问题