无法构建 gem —— 本机扩展构建失败 —— 你能明白为什么吗?
我不明白这里出了什么问题——有什么想法吗?
我在 Ubuntu 8.04 LTS 上运行,并按照以下说明安装了 libxml2 和 libxslt:
http://www.techsww.com/tutorials/libraries/libxml/installation/installing_libxml_on_ubuntu_linux.php
http://www.techsww.com/tutorials/libraries/libxslt/installation/installing_libxslt_on_ubuntu_linux.php
但是,我安装了最新版本:
libxslt-1.1.24
libxml2-2.7.3
安装很顺利
--------------------我设置了LD_LIBRARY_PATH
----------- -----------------------
echo $LD_LIBRARY_PATH
/usr/local/libxslt/lib:
------------- 似乎该函数存在 - 至少基于字符串的输出 ------------
/usr/local/libxslt/lib$ 字符串 * | grep ParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
----------------------- 但编译仍然失败-------------------- -------------------
sudo gem install webrat
构建本机扩展。 这可能需要一段时间...
错误:安装 webrat 时出错:
错误:无法构建 gem 本机扩展。
/usr/local/bin/ruby extconf.rb 安装 webrat
检查 /opt/local/include/、/opt/local/include/libxml2、/opt/local/include、/opt/local/include、/opt/local/include/libxml2、/usr/local 中的 iconv.h /include、/usr/local/include/libxml2、/usr/local/include、/usr/local/include/libxml2、/usr/include、/usr/include/libxml2... 是
检查 /opt/local/include/、/opt/local/include/libxml2、/opt/local/include、/opt/local/include、/opt/local/include/libxml2、/usr 中的 libxml/parser.h /local/include、/usr/local/include/libxml2、/usr/local/include、/usr/local/include/libxml2、/usr/include、/usr/include/libxml2... 是
检查 /opt/local/include/、/opt/local/include/libxml2、/opt/local/include、/opt/local/include、/opt/local/include/libxml2、/usr 中的 libxslt/xslt.h /local/include、/usr/local/include/libxml2、/usr/local/include、/usr/local/include/libxml2、/usr/include、/usr/include/libxml2... 是
检查 /opt/local/include/、/opt/local/include/libxml2、/opt/local/include、/opt/local/include、/opt/local/include/libxml2、/usr 中的 libexslt/exslt.h /local/include、/usr/local/include/libxml2、/usr/local/include、/usr/local/include/libxml2、/usr/include、/usr/include/libxml2... 是
检查 -lxml2 中的 xmlParseDoc()...是
检查 -lxslt 中的 xsltParseStylesheetDoc()... 否
libxslt 丢失。 尝试“port install libxslt”或“yum install libxslt-devel”
*** extconf.rb 失败 ***
由于某种原因无法创建 Makefile,可能缺少
必要的库和/或标头。 检查 mkmf.log 文件了解更多信息
细节。 您可能需要配置选项。
提供的配置选项:
--with-opt-dir
--没有选择目录
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--没有make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-iconv-dir
--没有 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
--没有-xml2lib
--with-xsltlib
--without-xsltlib
Gem 文件将保留安装在 /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.3.3 中以供检查。
结果记录到 /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.3.3/ext/nokogiri/gem_make.out
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试安装到非标准位置时出现相同的错误(因为我无权访问主目录之外的目录)。 似乎这个答案只是简单地安装到 /usr 中的默认位置即可成功。 还是我理解错了?
有关我正在尝试执行的操作的更多背景信息,请访问 http://groups .google.com/group/nokogiri-talk/browse_thread/thread/c1e909be09e90f5a,如果有帮助的话。
I get the same error when trying to install to a non-standard location (as I don't have access to directories outside my home directory). It seems as if this answer simply installed to the default location in /usr for success. Or did I misunderstand?
More context about what I'm trying to do at http://groups.google.com/group/nokogiri-talk/browse_thread/thread/c1e909be09e90f5a, if that's helpful.
尝试删除 libxslt* 并重新安装它们。 这为我解决了这个问题。
Try removing the libxslt* and install them again. That fixed the issue for me.
您必须安装这些库的开发套件。
You have to install the development kits of these libraries.
在 Ubuntu 中,您需要执行以下步骤:
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
In Ubuntu you need to follow these steps:
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
Jared Evans 在他的博客这篇文章中描述了一个在 Ubuntu 8.04 上对我有用的解决方案LTS。 他的技巧是不使用 apt-get 来安装 rubygems,而是从源代码构建它。 这对我来说非常有用。 他的帖子是针对安装
rails
的,因此我使用了以下(稍作修改的)步骤来安装 nokogiri:首先使用
APT-GET
安装 RUBY:除了 JARED'S我还安装了说明(我不确定
libxslt1.1
是否必要):下载 RUBYGEMS 源:
下载 来自 rubyforge 的最新 RubyGems (当前为 1.3.6)(我使用了 zip 包)。
构建 RUBYGEMS:
安装 NOKOGIRI:
响应将是:
我还没有注意到“无定义”消息引起的任何问题...
Jared Evans in this post on his blog, described a solution that worked for me on Ubuntu 8.04 LTS. His trick is to NOT use
apt-get
to install rubygems, but rather to build it from source. This worked great for me. His post is directed at installingrails
, so I used these (modified slightly) steps from it to just install nokogiri:FIRST INSTALL RUBY WITH
APT-GET
:IN ADDITION TO JARED'S INSTRUCTIONS I ALSO INSTALLED (I'm not certain that
libxslt1.1
is necessary):DOWNLOAD RUBYGEMS SOURCE:
Download the latest RubyGems (currently 1.3.6) from rubyforge (I used the zip package).
BUILD RUBYGEMS:
INSTALL NOKOGIRI:
The response will be:
I haven't yet noticed any problems caused by the 'No definition' messages...
这是在 Ubuntu 11.04 (natty) 上对我有用的方法:
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri
Here's what worked for me on Ubuntu 11.04 (natty):
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri