WedX - журнал о программировании и компьютерных науках

nokogiri не устанавливается в ruby ​​2.7.1 centos 7.2

Getting below error when installing nokogiri i tried

install -y make gcc rpm-build ruby-devel zlib-devel
gem install nokogiri

Building native extensions. This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
/usr/local/rvm/rubies/ruby-2.7.1/bin/ruby -I /usr/local/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r ./siteconf20200716-18065-1jmltdp.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.10
with the following patches applied:
        - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
        - 0002-Remove-script-macro-support.patch
        - 0003-Update-entities-to-remove-handling-of-ssi.patch
        - 0004-libxml2.la-is-in-top_builddir.patch
        - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.10.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxml2/2.9.10... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0002-Remove-script-macro-support.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch... OK
Running patch with /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch... OK
Running 'configure' for libxml2 2.9.10... OK
Running 'compile' for libxml2 2.9.10... OK
Running 'install' for libxml2 2.9.10... OK
Activating libxml2 2.9.10 (from /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ports/x86_64-pc-linux-gnu/libxml2/2.9.10)...
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxslt-1.1.34.

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install
************************************************************************
Extracting libxslt-1.1.34.tar.gz into tmp/x86_64-pc-linux-gnu/ports/libxslt/1.1.34... OK
Running 'configure' for libxslt 1.1.34... OK
Running 'compile' for libxslt 1.1.34... OK
Running 'install' for libxslt 1.1.34... OK
Activating libxslt 1.1.34 (from /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ports/x86_64-pc-linux-gnu/libxslt/1.1.34)...
checking for -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes
checking for exsltFuncRegister() in libexslt/exslt.h... 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

current directory: /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR=" clean

current directory: /usr/local/rvm/gems/ruby-2.7.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR="
compiling html_document.c
compiling html_element_description.c
compiling html_entity_lookup.c
compiling html_sax_parser_context.c
compiling html_sax_push_parser.c
compiling nokogiri.c
compiling xml_attr.c
compiling xml_attribute_decl.c
compiling xml_cdata.c
compiling xml_comment.c
compiling xml_document.c
xml_document.c: In function ‘dealloc’:
xml_document.c:49:3: warning: passing argument 2 of ‘rb_st_foreach’ from incompatible pointer type [enabled by default]
   st_foreach(node_hash, dealloc_node_i, (st_data_t)doc);
   ^
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/intern.h:39:0,
                 from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:2148,
                 from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33,
                 from ./nokogiri.h:33,
                 from ./xml_document.h:4,
                 from xml_document.c:1:
/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/st.h:141:5: note: expected ‘int (*)(st_data_t,  st_data_t,  st_data_t)’ but argument is of type ‘int (*)(struct xmlNode *, struct xmlNode *, struct xmlDoc *)’
 int rb_st_foreach(st_table *, st_foreach_callback_func *, st_data_t);
     ^
xml_document.c: At top level:
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
compiling xml_document_fragment.c
compiling xml_dtd.c
compiling xml_element_content.c
compiling xml_element_decl.c
compiling xml_encoding_handler.c
compiling xml_entity_decl.c
compiling xml_entity_reference.c
compiling xml_io.c
xml_io.c: In function ‘io_read_callback’:
xml_io.c:20:3: warning: passing argument 1 of ‘rb_rescue’ from incompatible pointer type [enabled by default]
   string = rb_rescue(read_check, (VALUE)args, read_failed, 0);
   ^
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0,
                 from ./nokogiri.h:33,
                 from ./xml_io.h:4,
                 from xml_io.c:1:
**/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7: note: expected ‘VALUE (*)(VALUE)’ but argument is of type ‘VALUE (*)(VALUE *)’
 VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);**
       ^
*xml_io.c:20:3: warning: passing argument 3 of ‘rb_rescue’ from incompatible pointer type [enabled by default]
   string = rb_rescue(read_check, (VALUE)args, read_failed, 0);
   ^*
In file included from /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0,
                 from ./nokogiri.h:33,
                 from ./xml_io.h:4,
                 from xml_io.c:1:
/usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7: note: expected ‘VALUE (*)(VALUE,  VALUE)’ but argument is of type ‘VALUE (*)(void)’
 VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);
       ^

xml_io.c: в функции 'io_write_callback': xml_io.c:47:3: предупреждение: передача аргумента 1 'rb_rescue' из несовместимого типа указателя [включено по умолчанию] size = rb_rescue(write_check, (VALUE)args, write_failed, 0 ); ^ В файле из /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0, из ./nokogiri.h:33, из ./xml_io. h:4, из xml_io.c:1: /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7: примечание: ожидается 'VALUE ( )(VALUE)', но аргумент имеет тип 'VALUE ()(VALUE )' VALUE rb_rescue(VALUE()(VALUE),VALUE,VALUE() (ЗНАЧ,ЗНАЧ),ЗНАЧ); ^ xml_io.c:47:3: предупреждение: передача аргумента 3 «rb_rescue» из несовместимого типа указателя [включено по умолчанию] size = rb_rescue(write_check, (VALUE)args, write_failed, 0); ^ В файле из /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby.h:33:0, из ./nokogiri.h:33, из ./xml_io. h:4, из xml_io.c:1: /usr/local/rvm/rubies/ruby-2.7.1/include/ruby-2.7.0/ruby/ruby.h:1987:7: примечание: ожидается 'VALUE ( )(VALUE, VALUE)', но аргумент имеет тип 'VALUE ()(void)' VALUE rb_rescue(VALUE()(VALUE),VALUE,VALUE(*)(VALUE, ЗНАЧЕНИЕ), ЗНАЧЕНИЕ);

       ^
***xml_io.c: At top level:
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
compiling xml_libxml2_hacks.c
compiling xml_namespace.c
compiling xml_node.c
xml_node.c: In function ‘reparent_node_with’:
xml_node.c:304:7: warning: passing argument 1 of ‘xmlFree’ discards ‘const’ qualifier from pointer target type [enabled by default]
       xmlFree(reparentee->ns->prefix);
       ^***
xml_node.c:304:7: note: expected ‘void *’ but argument is of type ‘const xmlChar *’
xml_node.c: At top level:
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
compiling xml_node_set.c
compiling xml_processing_instruction.c
compiling xml_reader.c
compiling xml_relax_ng.c
compiling xml_sax_parser.c
compiling xml_sax_parser_context.c
compiling xml_sax_push_parser.c
compiling xml_schema.c
compiling xml_syntax_error.c
compiling xml_text.c
compiling xml_xpath_context.c
compiling xslt_stylesheet.c
xslt_stylesheet.c:112:13: warning: ‘swallow_superfluous_xml_errors’ defined but not used [-Wunused-function]
 static void swallow_superfluous_xml_errors(void * userdata, xmlErrorPtr error, ...)
             ^
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-cast-function-type" [enabled by default]
linking shared-object nokogiri/nokogiri.so
/usr/bin/ld: unrecognized option '--compress-debug-sections=zlib'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
make: *** [nokogiri.so] Error 1

make failed, exit code 2

  • это не отформатировано, но я надеюсь, что это даст представление 16.07.2020
  • я думаю, вам также нужны libxml-devel и libxslt-devel или как они там называются... 16.07.2020
  • это не отформатировано, но я надеюсь, что это даст представление. Затем отформатируйте его. Правильное форматирование является важной частью постановки вопроса и членства в сообществе. Прочтите их, а затем отредактируйте и улучшите свой вопрос: Как мне форматировать мои сообщения... и Как форматировать блоки кода?. Помните, что когда вы не прилагаете усилий, чтобы правильно задать вопрос, он становится менее понятным, с меньшей вероятностью даст полезный ответ и вынуждает нас пытаться его исправить. 17.07.2020
  • @NickM я получаю сообщение Пакет libxml2-devel-2.9.1-6.el7.4.x86_64 уже установлен и имеет последнюю версию, а пакет libxslt-devel-1.1.28-5.el7.x86_64 уже установлен и имеет последнюю версию. Так что последний пакет libxml2 и libxlt уже есть. 17.07.2020
  • Только что обнаружил, что устанавливается nokogiri 1.11.0.rc2, не уверен, что эта версия стабильна для использования. 17.07.2020

Ответы:


1

поскольку моя версия centos устарела и /usr/bin/ld является частью binutils, поэтому мое предложение

$ sudo yum update binutils

мне помогло (вместо полного обновления ОС)

18.09.2020

2

Моя версия Centos была 7.6, и все предоставленные решения для nokogiri не работали. Наконец-то я обновил Centos до 7.8, и все заработало. Я также пробовал использовать версию Centos 7.7 на другом сервере, он работал и на 7.7.

22.07.2020

3

я столкнулся с точно такой же проблемой. Кажется, что настоящая ошибка

/usr/bin/ld: нераспознанный параметр '--compress-debug-sections=zlib'

Флаг --compress-debug-sections=zlib определен в файле /usr/local/rvm/gems/ruby-2.7.0/gems/nokogiri-1.10.10/ext/nokogiri/Makefile. Этот make-файл создается mkmf.rb, а значения флагов по умолчанию находятся в этом файле /usr/local/rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/x86_64-linux/rbconfig. .rb

CONFIG[DLDFLAGS] = -Wl,--compress-debug-sections=zlib

После того, как я изменил эту строку на

КОНФИГУРАЦИЯ[DLDFLAGS] =

gem install nokogiri работает хорошо

Но я не уверен в точной функции флага --compress-debug-sections=zlib и в том, что произойдет, если я его удалю.

11.08.2020

4

Эта ошибка возникает из-за того, что компоновщик по умолчанию на Centos 7.4 не поддерживает эту опцию --compress-debug-sections=zlib. Centos 7.8 похоже решает эту проблему.

Но на случай, если вы не смогли переключиться на Centos 7.8, этот вариант поддерживается линкером gold (ld.gold).

Чтобы разрешить использование, вы можете переопределить компоновщик, выполнив что-то вроде

ln -s /bin/ld.gold ~/bin/ld; PATH=~/bin:$PATH

затем запустите нужную команду

21.11.2020
Новые материалы

Я хотел выучить язык программирования MVC4, но не мог выучить его раньше, потому что это выглядит сложно…
Просто начните и учитесь самостоятельно Я хотел выучить язык программирования MVC4, но не мог выучить его раньше, потому что он кажется мне сложным, и я бросил его. Это в основном инструмент..

Лицензии с открытым исходным кодом: руководство для разработчиков и создателей
В динамичном мире разработки программного обеспечения открытый исходный код стал мощной парадигмой, способствующей сотрудничеству, инновациям и прогрессу, движимому сообществом. В основе..

Объяснение документов 02: BERT
BERT представил двухступенчатую структуру обучения: предварительное обучение и тонкая настройка. Во время предварительного обучения модель обучается на неразмеченных данных с помощью..

Как проанализировать работу вашего классификатора?
Не всегда просто знать, какие показатели использовать С развитием глубокого обучения все больше и больше людей учатся обучать свой первый классификатор. Но как только вы закончите..

Работа с цепями Маркова, часть 4 (Машинное обучение)
Нелинейные цепи Маркова с агрегатором и их приложения (arXiv) Автор : Бар Лайт Аннотация: Изучаются свойства подкласса случайных процессов, называемых дискретными нелинейными цепями Маркова..

Crazy Laravel Livewire упростил мне создание электронной коммерции (панель администратора и API) [Часть 3]
Как вы сегодня, ребята? В этой части мы создадим CRUD для данных о продукте. Думаю, в этой части я не буду слишком много делиться теорией, но чаще буду делиться своим кодом. Потому что..

Использование машинного обучения и Python для классификации 1000 сезонов новичков MLB Hitter
Чему может научиться машина, глядя на сезоны новичков 1000 игроков MLB? Это то, что исследует это приложение. В этом процессе мы будем использовать неконтролируемое обучение, чтобы..


Для любых предложений по сайту: [email protected]