代码之家  ›  专栏  ›  技术社区  ›  tfwright

在雪豹上安装一些宝石时出错-libxml2

  •  8
  • tfwright  · 技术社区  · 15 年前

    升级到雪豹之后,我发现安装一些宝石不再有效,包括Webrat、Mechanical等。每次出现此错误时:

    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,/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
    
    3 回复  |  直到 15 年前
        1
  •  1
  •   Rob Jones    15 年前

    Floyd的解决方案是过度杀戮——我也遇到了同样的问题,开始使用与xml2相关的/opt/local文件,但是他的“find”命令并没有在opt/local/lib中显示实际的lib xml2文件。可能你只是需要用核武器。

    以下是我的核文件:

    /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
    

    但在你尝试之前-只需核库文件 sudo rm/opt/local/lib/libxml2.*

    当我尝试安装之后,它开始编译它,但后来又出现了libz问题…

    所以在/opt/local/lib中使用核武器 sudo rm-rf/opt/local/lib/libz.*

    它编译得很好!

    因此,尝试nuking/opt/local/lib libxml2.*和libz.*文件,查看它是否编译,如果不编译,nuke/opt/local/includes

        2
  •  1
  •   tfwright    15 年前

    更新

    如另一个答案所述,下面的解决方案是“过度杀戮”,因为它从您的系统中删除了MacPorts,我认为我之前已经做过。小心操作。可能有一种方法可以使用MacPorts来更新libxml2安装。


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

    当我意识到跟踪中没有任何东西表明缺少libxml2,而是检测到的版本有问题时,我环顾四周以确认这一事实。当然了, nokogiri website (许多类似的bug报告指出我)毫不确定地指出,雪豹船上有一个良好的工作版本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的痕迹 从垃圾堆外面一直萦绕着我。

        3
  •  0
  •   Dave Bacher    15 年前

    您要安装的gems需要libxml2。如果您愿意从源代码安装,请安装 libxml2 .

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