安装引入nokogiri - 无法建立宝石原生扩展(Installing nokogiri - F

2019-08-04 15:09发布

尽管在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的,但你看,它并没有帮助。

如何解决这个问题呢?

Answer 1:

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

在引入nokogiri更新日志显示,他们在1.5.4解决了这个问题:

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



Answer 2:

我在这个偶然试图在Ubuntu 13.04安装bigbluebutton

我解决了它这种技巧编译恢复的-Wformat安全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'


Answer 3:

@Confusion有正确的想法。

捆绑器可能锁定引入nokogiri-1.4.4在Gemfile中和/或Gemfile.lock的。 @运行包更新应该让你的Ruby捆扎机环境中使用安装成功引入nokogiri-1.5.6的混乱的答案。



文章来源: Installing nokogiri - Failed to build gem native extension