问题描述
正如标题所述,它似乎没有失败,因为缺少libxml2或libxslt.我不太确定该怎么做 该错误. (明白吗?因为问题出在制造过程中?呵呵...)
As the title says, it doesn't seem to be failing because libxml2 or libxslt is missing. I'm not really sure what to make of the error. (Get it? Because the issue is during make? hehe...)
任何人,这是我得到的输出.任何想法将不胜感激:
Anywho, here's the output I'm getting. Any ideas would be appreciated:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
extconf.rb:10: Use RbConfig instead of obsolete and deprecated Config.
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
make
compiling xml_element_content.c
compiling xml_relax_ng.c
compiling xml_cdata.c
compiling xml_sax_parser_context.c
compiling xml_node_set.c
compiling xml_text.c
compiling xml_sax_parser.c
compiling xml_attribute_decl.c
compiling nokogiri.c
nokogiri.c: In function ‘ruby_strdup’:
nokogiri.c:43:31: warning: conversion to ‘size_t’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
compiling xml_entity_reference.c
compiling xml_node.c
compiling xml_xpath_context.c
xml_xpath_context.c: In function ‘xpath_generic_exception_handler’:
xml_xpath_context.c:184:3: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [xml_xpath_context.o] Error 1
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.5.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.5.0/ext/nokogiri/gem_make.out
对于上下文,我昨晚从Ubuntu 12.04升级到12.10.我以前曾在此盒子上构建过Nokogiri本机扩展,尽管我不知道它是否是同一版本.
For context, I upgraded from Ubuntu 12.04 to 12.10 last night. I had previously built the Nokogiri native extension on this box, though I do not know if it was the same version or not.
我还检查了我是否具有在"在带滑轨3.1.0和ubuntu的系统上安装nokogiri 1.5.0时出错" 无济于事.
I also checked that I have all packages specified in the second post on "error installing nokogiri 1.5.0 with rails 3.1.0 and ubuntu" to no avail.
推荐答案
如果您要安装Nokogiri< 1.5.4,在诸如Debian Ubuntu 12之类的强化Debian系统上会遇到问题.
If you're trying to install Nokogiri < 1.5.4, you'll have problems on hardened Debian systems like Ubuntu 12.
有关此基本问题的详细信息在这里: https://github.com/sparklemotion/nokogiri/Issues/680
Details on the underlying issue are here: https://github.com/sparklemotion/nokogiri/issues/680
您应该能够升级到1.5.4或更高版本,并且安装时不会出现此问题.
You should be able to upgrade to 1.5.4 or later and install without this problem.
或者,您应该能够在gem-install时将CFLAGS环境变量设置为包含字符串:
Alternatively, you should be able to set the CFLAGS environment variable at gem-install time to include the string:
-Wno-error=format-security
或
-Wformat-nonliteral -Wno-format-security
祝你好运!
这篇关于Nokogiri本机扩展无法生成(不是libxml2或libxslt缺少问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!