安装nokogiri - 无法构建gem原生扩展 [英] Installing nokogiri - Failed to build gem native extension

查看:81
本文介绍了安装nokogiri - 无法构建gem原生扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ubuntu 12上安装Nokogiri时,出现错误:

While installing Nokogiri on Ubuntu 12, I got an error:

Installing nokogiri (1.4.4) with native extensions 
Gem::Installer::ExtensionBuildError: 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 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 html_sax_parser_context.c                                                             
compiling xml_io.c                                                                              
compiling xml_entity_reference.c                                                                
compiling xml_schema.c                                                                          
compiling xml_element_content.c                                                                 
compiling xml_reader.c                                                                          
compiling xml_sax_push_parser.c                                                                 
compiling xml_sax_parser.c                                                                      
compiling xslt_stylesheet.c                                                                     
compiling xml_element_decl.c                                                                    
compiling xml_node.c                                                                            
compiling xml_cdata.c                                                                           
compiling xml_processing_instruction.c
compiling xml_entity_decl.c
compiling xml_attribute_decl.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 /home/alex/.bundler/tmp/22194/gems/nokogiri-1.4.4 for inspection.
Results logged to /home/alex/.bundler/tmp/22194/gems/nokogiri-1.4.4/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.4.4), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.4.4'` succeeds before bundling.

我已经安装了libxslt-dev和libxml2-dev,但正如您所看到的,它没有帮助。

I already installed libxslt-dev and libxml2-dev, but as you see, it didn't help.

我该如何解决它?

How do I solve it?

推荐答案

你需要1.4.4而不是最新的1.5.6的具体原因?否则我建议升级。

Is there a specific reason you need 1.4.4 instead of the latest 1.5.6? Otherwise I suggest upgrading.

Nokogiri changelog 显示他们在1.5.4中修复了这个问题:

The Nokogiri changelog shows they fixed this in 1.5.4:


在使用$ b $的强化Debian系统上构建支持b -Werror =格式安全性。 #680。

这篇关于安装nokogiri - 无法构建gem原生扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆