安装诺科吉里 - 无法构建宝石本机扩展



在Ubuntu 12上安装Nokogiri时,我有一个错误:

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,但是如您所见,它没有帮助。

我该如何解决?

我偶然发现了在Ubuntu上安装BigBlueButton 13.04

我解决了这样的技巧,以编译以恢复-wformat -security gcc标志

请小心执行第一个rm。它可以破坏您的整个系统!

rm /usr/bin/gcc
nano /usr/bin/gcc
    ## contents of /usr/bin/gcc
    #!/bin/sh
    gcc-4.7 $* -Wno-format-security
    ## save and exit
chmod u+x /usr/bin/gcc
gem install nokogiri -v '1.4.4'

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

Nokogiri ChangElog显示他们在1.5.4中修复了这一点:

建立支持使用的硬化的Debian系统的支持 -Werror=format-security。#680。

@confusion具有正确的想法。

Bundler可能被锁定到gemfile和/或gemfile.lock中的诺科吉里1.4.4。@混乱的运行捆绑包更新的答案应允许您的Ruby Bundler环境使用成功安装的Nokogiri-1.5.6。

相关内容

  • 没有找到相关文章

最新更新