3

タイトルが示すように、libxml2またはlibxsltが欠落しているため、失敗しているようには見えません。エラーをどうすればいいのよくわかりません。(わかりますか?問題はmake中ですか?hehe ...)

とにかく、これが私が得ている出力です。任意のアイデアをいただければ幸いです。

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    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_element_content.c
compiling xml_relax_ng.c
compiling xml_cdata.c
compiling xml_sax_parser_context.c
compiling xml_node_set.c
compiling xml_text.c
compiling xml_sax_parser.c
compiling xml_attribute_decl.c
compiling nokogiri.c
nokogiri.c: In function ‘ruby_strdup’:
nokogiri.c:43:31: warning: conversion to ‘size_t’ from ‘long int’ may change the sign of the result [-Wsign-conversion]
compiling xml_entity_reference.c
compiling xml_node.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 /var/lib/gems/1.9.1/gems/nokogiri-1.5.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.5.0/ext/nokogiri/gem_make.out

コンテキストとして、昨夜、Ubuntu12.04から12.10にアップグレードしました。同じバージョンかどうかはわかりませんが、以前にこのボックスにNokogiriネイティブ拡張機能を構築しました。

また、「 nokogiri1.5.0とrails3.1.0およびubuntuのインストールエラー」に関する2番目の投稿で指定されているすべてのパッケージが役に立たないことを確認しました。

4

4 に答える 4

7

cflagsを追加する方法を理解するのに少し時間がかかりました。これがnokogiri1.4.7の私のコマンドです:

sudo gem install  nokogiri -v '1.4.7' -- --with-cflags=\"-Wformat-nonliteral -Wno-format-security\"
于 2014-11-04T12:17:30.457 に答える
5

nokogiriに次の依存関係をインストールしてみましたか?

# nokogiri requirements
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri
于 2012-12-20T10:36:50.907 に答える
5

Nokogiri <1.5.4をインストールしようとすると、Ubuntu12のような強化されたDebianシステムで問題が発生します。

根本的な問題の詳細はここにあります:https ://github.com/sparklemotion/nokogiri/issues/680

1.5.4以降にアップグレードして、この問題なくインストールできるはずです。

または、gem-install時にCFLAGS環境変数を設定して、次の文字列を含めることができるはずです。

-Wno-error=format-security

また

-Wformat-nonliteral -Wno-format-security

幸運を!

于 2012-12-28T16:02:42.900 に答える
0

これは、このバグが原因で発生している可能性があります> https://leap.se/code/issues/7231

コマンドを実行する前に、以下を実行してください。

sudo apt-get install zlib1g-dev
于 2015-10-14T12:15:41.993 に答える