簡體   English   中英

在Ubuntu 12.10上安裝Nokogiri(1.5.2)的問題

[英]Problems installing Nokogiri (1.5.2) on Ubuntu 12.10

我正在運行Ubuntu 12.10,當我運行命令時:

bundle install

我明白了:

Installing nokogiri (1.5.2) 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 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_processing_instruction.c
compiling xml_node.c
compiling html_entity_lookup.c
compiling xml_syntax_error.c
compiling xml_document.c
xml_document.c: In function ‘set_encoding’:
xml_document.c:159:12: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
xml_document.c: In function ‘canonicalize’:
xml_document.c:505:15: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
compiling xml_encoding_handler.c
compiling xml_namespace.c
xml_namespace.c: In function ‘prefix’:
xml_namespace.c:14:13: warning: variable ‘doc’ set but not used [-Wunused-but-set-variable]
xml_namespace.c: In function ‘href’:
xml_namespace.c:33:13: warning: variable ‘doc’ set but not used [-Wunused-but-set-variable]
compiling xml_entity_decl.c
compiling xml_attribute_decl.c
compiling xml_comment.c
compiling xml_dtd.c
compiling xml_xpath_context.c
xml_xpath_context.c: In function ‘xpath_generic_exception_handler’:
xml_xpath_context.c:189: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/site/.bundler/tmp/19240/gems/nokogiri-1.5.2 for inspection.
Results logged to /home/site/.bundler/tmp/19240/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.5.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.2'` succeeds before bundling.

當我跑:

gem install nokogiri -v '1.5.2'

我明白了:

site@ubuntu:~/Documents/shopqi$ gem install nokogiri -v '1.5.2'
malloc_limit=60000000 (8000000)
free_min=50000 (4096)
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.5.2
1 gem installed
Installing ri documentation for nokogiri-1.5.2...
Installing RDoc documentation for nokogiri-1.5.2...
site@ubuntu:~/Documents/shopqi$

沒有錯誤,但如果我再次嘗試bundle install ,我會收到Nokogiri未安裝的錯誤。

運行sudo gem install nokogiri -v'1.5.2'后gem_make.out的內容是:

/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_processing_instruction.c
compiling xml_node.c
compiling html_entity_lookup.c
compiling xml_syntax_error.c
compiling xml_document.c
xml_document.c: In function ‘set_encoding’:
xml_document.c:159:12: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
xml_document.c: In function ‘canonicalize’:
xml_document.c:505:15: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
compiling xml_encoding_handler.c
compiling xml_namespace.c
xml_namespace.c: In function ‘prefix’:
xml_namespace.c:14:13: warning: variable ‘doc’ set but not used [-Wunused-but-set-variable]
xml_namespace.c: In function ‘href’:
xml_namespace.c:33:13: warning: variable ‘doc’ set but not used [-Wunused-but-set-variable]
compiling xml_entity_decl.c
compiling xml_attribute_decl.c
compiling xml_comment.c
compiling xml_dtd.c
compiling xml_xpath_context.c
xml_xpath_context.c: In function ‘xpath_generic_exception_handler’:
xml_xpath_context.c:189: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

有什么幫助嗎?

先試試這個:

$  apt-get install libxml2-dev libxslt1-dev

另外,如果您使用的是rvm,請執行以下操作:

$ rvm requirements

Ubuntu 12.10采用Debian的強化包裝器,它包含一組導致此編譯錯誤的GCC默認標志。 我們已經在Nokogiri 1.5.4及更高版本中解決了這個問題,因此您需要升級或找到自己的解決方法。

有關Debian強化的信息,請參見此處

有關Team Nokogiri使用的解決方案的詳細信息,請參見此處

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM