8

升级到雪豹后,我发现,不再安装某些宝石的工作,包括webrat,机械化等。每次我得到这个错误:错误在Snow Leopard上安装某些宝石 - libxml2的

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。从那以后,我从一个人手中变得非常舒适,这是我第一次碰到超出我的范围的东西。我很乐意被说服回到m​​acports,但前提是没有简单的解决方案来解决这个问题。

它不会出现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,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes 
checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes 
checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes 
checking for libexslt/exslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/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 

回答

1

UPDATE

正如另一个答案所述,下面的解决方案是“矫枉过正”,因为它从你的系统,我认为我已经做得比较早的MacPorts删除。仔细处理。可能有一种方法可以使用MacPorts来更新libxml2安装。


我解决了这个问题(至少在我的机器上)。

一旦我意识到该跟踪中没有任何内容表明缺少libxml2,而是在检测到版本时出现问题,我环顾四周以确认这一事实。果然,nokogiri website(许多类似的错误报告指出了我)毫不含糊地指出Snow Leopard提供了一个良好的libxml2工作版本。

因此,我推断我很早以前就已经用另一种方法安装了一个版本。我会记得如果我手动安装,所以实际上只剩下一个选项,frickin'macports。

$ libxml2-2.7.1 tfwright$ sudo find/-type d -name "libxml2" 
find: /dev/fd/3: Not a directory 
find: /dev/fd/4: Not a directory 
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/libxml2 
/Developer/SDKs/MacOSX10.5.sdk/usr/include/libxml2 
/Developer/SDKs/MacOSX10.6.sdk/usr/include/libxml2 
/opt/local/include/libxml2 
/opt/local/share/gtk-doc/html/libxml2 
/opt/local/var/macports/distfiles/libxml2 
/opt/local/var/macports/receipts/libxml2 
/opt/local/var/macports/software/libxml2 
/opt/local/var/macports/software/libxml2/2.6.30_0/opt/local/include/libxml2 
/opt/local/var/macports/software/libxml2/2.6.30_0/opt/local/share/gtk-doc/html/libxml2 
/opt/local/var/macports/sources/rsync.macports.org/release/ports/textproc/libxml2 
/usr/include/libxml2 
/usr/share/gtk-doc/html/libxml2 

儿子的...只是吹走/opt/local/var/macports,这是我第一次尝试的是,似乎没有解决这个问题,所以我去了big guns

sudo rm -rf \ 
/opt/local \ 
/Applications/DarwinPorts \ 
/Applications/MacPorts \ 
/Library/LaunchDaemons/org.macports.* \ 
/Library/Receipts/DarwinPorts*.pkg \ 
/Library/Receipts/MacPorts*.pkg \ 
/Library/StartupItems/DarwinPortsStartup \ 
/Library/Tcl/darwinports1.0 \ 
/Library/Tcl/macports1.0 \ 
~/.macports 

之后,一切安装正常。那就对了。永远不要相信错误消息的建议!远不需要使用macports重新安装libxml2,我需要擦除我的系统中的所有macports痕迹,这些痕迹让我难以理解垃圾。

+0

感谢@floyd也为我工作 – 2012-12-20 09:10:32

0

你要安装的libxml2需要的宝石。如果您愿意从源代码安装,请安装libxml2

您可能会遇到依赖性问题,其中libxml2依赖于您需要手动构建和安装的一堆其他包。这是macport最终变得有用的原因之一。

+0

我超越了我肯说,因为没有按似乎没有任何从源代码安装libxml2的权威指南。而根据我的经验,在没有一些指导的情况下,有太多隐藏的陷阱可以冒险。你提到的依赖问题正是我所说的。你是否说在这种情况下有太多的依赖关系,制定一个简单的配方是不合理的,比如SQL,ruby等存在的那些(hivelogic指南)? – tfwright 2010-01-16 01:32:31

1

floyd的解决方案是过度杀伤 - 我有同样的问题,并开始nucking一些相同的/ opt /本地文件与xml2相关,但他的'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文件 须藤RM /opt/local/lib/libxml2.*

当我试图安装之后,它钻进编译这一切,但随后barfed与libz进行的一个问题...

所以核弹是在/ opt/local/lib目录 须藤室射频/opt/local/lib/libz.*

它编译得很好!

所以要尽量的摧毁到/ opt/local/lib目录的libxml2。*和libz进行。*文件,看它是否编译,如果没有,核弹到/ opt /本地/包括