升级到Snow Leopard后,我发现安装一些宝石不再有效,包括webrat,mechanize等.每次我收到此错误:
checking for xmlParseDoc() in -lxml2... no libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' *** 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.
不,我没有尝试用macports安装它,因为几年前我发现我无法轻易降级/管理端口时,我放弃了macports.从那时起,我已经变得非常舒适地手工制作源头,这是我第一次遇到超出我的想法.我愿意被说服回到macports,但只有在没有简单解决方案的情况下我才会失踪.
似乎libxml2实际上并不存在,或许只是过时了?…
扩展输出
ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes checking for libxml/parser.h in /opt/local/include/,/usr/include/libxml2... yes checking for libxslt/xslt.h in /opt/local/include/,/usr/include/libxml2... yes checking for libexslt/exslt.h in /opt/local/include/,/usr/include/libxml2... yes checking for xmlParseDoc() in -lxml2... no libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' *** 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=/usr/local/bin/ruby --with-iconv-dir --without-iconv-dir --with-iconv-include --without-iconv-include=${iconv-dir}/include --with-iconv-lib --without-iconv-lib=${iconv-dir}/lib --with-xml2-dir --without-xml2-dir --with-xml2-include --without-xml2-include=${xml2-dir}/include --with-xml2-lib --without-xml2-lib=${xml2-dir}/lib --with-xslt-dir --without-xslt-dir --with-xslt-include --without-xslt-include=${xslt-dir}/include --with-xslt-lib --without-xslt-lib=${xslt-dir}/lib --with-xml2lib --without-xml2lib Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1 for inspection. Results logged to /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.4.1/ext/nokogiri/gem_make.out
解决方法
floyd的解决方案是矫枉过正 – 我遇到了同样的问题,并开始查找与xml2相关的一些相同的/ opt / local文件,但是他的’find’命令没有显示opt / local / lib中的实际libxml2文件.可能你只需要核武器.
这是我的核心文件:
/opt/local/include/libxml2 /opt/local/var/db/dports/distfiles/libxml2 /opt/local/var/db/dports/receipts/libxml2 /opt/local/var/db/dports/software/libxml2 /opt/local/var/db/dports/rsync.rsync.darwinports.org_dpupdate_dports/textproc/libxml2 /opt/local/share/gtk-doc/html/libxml2 /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/textproc/libxml2
但在你尝试之前 – 只需核对lib文件
sudo rm /opt/local/lib/libxml2.*
当我试图安装之后,它进行了编译,然后用libz的问题进行了解决…
所以在/ opt / local / lib中核对
sudo rm -rf /opt/local/lib/libz.*
它编译得很好!
所以尝试查看/ opt / local / lib libxml2.*和libz.*文件,查看是否编译,如果没有,请查看/ opt / local / includes