【问题标题】:Installing mechanize gem on Mac OS X 10.4.11 gives 'Failed to build gem native extension'在 Mac OS X 10.4.11 上安装 mechanize gem 会出现“无法构建 gem 原生扩展”
【发布时间】:2009-04-01 08:14:26
【问题描述】:

我正在尝试在 MAC OS X 上安装 mechanize gem,但我不断收到以下错误:

错误:安装机械化时出错:
错误:无法构建 gem 原生扩展。

/usr/local/bin/ruby extconf.rb 安装 mechanize
检查#include
...是的
检查#include
...是的
检查#include
...是的
检查#include
...是的
检查 -lxml2 中的 xmlParseDoc()... 是
检查 -lxslt 中的 xsltParseStylesheetDoc()... 是
检查 -lexslt 中的 exsltFuncRegister()... 是的
创建 Makefile

** 制作 gcc -I。 -一世。 -I/usr/local/lib/ruby/1.8/i686-darwin8.9.1 -I. -I/opt/local/include/ -I/opt/local/include/libxml2 -fno-common -g -O2 -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings - Wconversion -Wmissing-noreturn -Winline -c html_document.c
在 ./html_document.h:4 中包含的文件中,
来自 html_document.c:1:
./native.h:11:28: 错误: libxml/xmlsave.h: 没有这样的文件或目录
make: * ** [html_document.o] 错误 1**

所以在 /opt/local/include/ 或 /opt/local/include/libxml2 中找不到 xmlsave.h 问题是 libxml2 作为框架安装在 /Library/Frameworks/libxml2.framework/

然后我决定创建一个从 libxml 头目录到 /opt/local/include/xml2 的符号链接,所以我这样做了

ln -s /Library/Frameworks/libxml2.framework/Headers/libxml/ libxml2

但我仍然无法安装 gem。

非常感谢任何指针或想法。

【问题讨论】:

    标签: macos gem mechanize-ruby


    【解决方案1】:

    我遇到了同样的问题,不是安装 mechanize 而是 webrat。这对我有用:

    sudo ln -s /usr/include/libxml2 /opt/local/include/libxml2
    

    【讨论】:

      猜你喜欢
      • 2016-01-17
      • 2015-06-17
      • 1970-01-01
      • 2012-11-02
      • 1970-01-01
      • 1970-01-01
      • 2012-08-01
      • 2013-03-09
      • 2013-11-01
      相关资源
      最近更新 更多