nokogiri (1.5.2)が入らない!!件
Feb 27, 2014Rails3.1の古い案件の修正が入ったので、環境を構築していたのですが、Nokogiriが1.5.2を入れないと動かない構成でして、苦労しましたのでメモしておきます。
エラー内容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
$bundle install 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_io.c xml_io.c: In function ‘io_read_callback’: xml_io.c:28:3: warning: conversion to ‘int’ from ‘size_t’ may alter its value [-Wconversion] compiling xml_reader.c compiling xml_element_content.c compiling xml_entity_decl.c compiling xml_sax_push_parser.c compiling xml_node_set.c xml_node_set.c: In function ‘dealloc_namespace’: xml_node_set.c:9:13: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] xml_node_set.c:11:13: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] compiling xml_processing_instruction.c compiling xml_comment.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_sax_parser.c compiling xml_schema.c compiling xml_attribute_decl.c compiling html_sax_parser_context.c compiling xml_dtd.c compiling xml_encoding_handler.c compiling xml_element_decl.c compiling xml_entity_reference.c compiling html_entity_lookup.c compiling html_document.c compiling xml_syntax_error.c compiling html_element_description.c html_element_description.c: In function ‘get_description’: html_element_description.c:249:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] compiling xml_document_fragment.c compiling nokogiri.c compiling xml_node.c compiling xml_cdata.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/vagrant/.bundler/tmp/3761/gems/nokogiri-1.5.2 for inspection. Results logged to /home/vagrant/.bundler/tmp/3761/gems/nokogiri-1.5.2/ext/nokogiri/gem_make.out An error occurred while installing nokogiri (1.5.2), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.5.2'` succeeds before bundling. |
解決方法
NokogiriとUbuntuで下記のもので入るようになるとはあるのですが、1.5.2はこれでもうまく行かず。。
1 |
sudo apt-get install libxml2-dev libxslt1-dev |
下記のオプションをつけてなんとかインストールできました。
1 |
sudo gem install nokogiri -v '1.5.2' -- --with-cflags="-O2 -pipe -march=native -w" |
Twitter:
Warning: Undefined array key "Twitter" in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/plugins/sns-count-cache/sns-count-cache.php on line 2897
0 | Facebook: 0 | Google Plus:
Warning: Undefined array key "Google+" in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/plugins/sns-count-cache/sns-count-cache.php on line 2897
0 | Hatena: 0 | Pocket: 1 | Total: 1 | Feedly: 0