未能在Mac Catalina上安装Nokogiri



我正试图设置我的本地环境并安装nokogiri,但遇到了这个错误(很抱歉长度太长(:

ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/bin/ruby -I /Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200716-95822-kw9idg.rb extconf.rb
checking if the C compiler accepts  -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... 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-apple-darwin17.7.0/ports/libxml2/2.9.10... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0002-Remove-script-macro-support.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch... OK
Running git apply with /Users/michaelnavoy/.rvm/gems/ruby-2.6.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 /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ports/x86_64-apple-darwin17.7.0/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-apple-darwin17.7.0/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 /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ports/x86_64-apple-darwin17.7.0/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: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR=" clean
current directory: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR="
compiling html_document.c
html_document.c:16:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "0*", &rest);
^
1 warning generated.
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
xml_attr.c:61:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &document, &name, &rest);
^
1 warning generated.
compiling xml_attribute_decl.c
compiling xml_cdata.c
xml_cdata.c:23:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &doc, &content, &rest);
^
xml_cdata.c:29:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
content_str_len = RSTRING_LEN(content);
~ ^~~~~~~~~~~~~~~~~~~~
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/include/ruby-2.6.0/ruby/ruby.h:1000:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : 
^~~~~~~~~~~~~~~~~~~~~~
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/include/ruby-2.6.0/ruby/ruby.h:996:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xml_cdata.c:29:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
content_str_len = RSTRING_LEN(content);
~ ^~~~~~~~~~~~~~~~~~~~
/Users/michaelnavoy/.rvm/rubies/ruby-2.6.1/include/ruby-2.6.0/ruby/ruby.h:1001:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
3 warnings generated.
compiling xml_comment.c
xml_comment.c:21:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &document, &content, &rest);
^
1 warning generated.
compiling xml_document.c
xml_document.c:330:31: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
if(rb_scan_args(argc, argv, "01", &level) == 0)
^
xml_document.c:357:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "0*", &rest);
^
xml_document.c:436:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "14", &name, &type, &external_id, &system_id,
^
xml_document.c:511:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "03", &mode, &incl_ns, &with_comments);
^
4 warnings generated.
compiling xml_document_fragment.c
xml_document_fragment.c:17:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "1*", &document, &rest);
^
1 warning generated.
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
xml_entity_reference.c:18:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &document, &name, &rest);
^
1 warning generated.
compiling xml_io.c
compiling xml_libxml2_hacks.c
compiling xml_namespace.c
compiling xml_node.c
xml_node.c:304:15: warning: passing 'const xmlChar *' (aka 'const unsigned char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
xmlFree(reparentee->ns->prefix);
^~~~~~~~~~~~~~~~~~~~~~
xml_node.c:550:37: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
n_args = rb_scan_args(argc, argv, "02", &r_level, &r_new_parent_doc);
^
xml_node.c:1393:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &name, &document, &rest);
^
3 warnings generated.
compiling xml_node_set.c
xml_node_set.c:294:30: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "11", NULL, NULL);
^
1 warning generated.
compiling xml_processing_instruction.c
xml_processing_instruction.c:20:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "3*", &document, &name, &content, &rest);
^
1 warning generated.
compiling xml_reader.c
xml_reader.c:533:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "13", &rb_buffer, &rb_url, &encoding, &rb_options);
^
xml_reader.c:577:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "13", &rb_io, &rb_url, &encoding, &rb_options);
^
2 warnings generated.
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
xml_text.c:18:28: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "2*", &string, &document, &rest);
^
1 warning generated.
compiling xml_xpath_context.c
xml_xpath_context.c:200:31: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
if(rb_scan_args(argc, argv, "11", &search_path, &xpath_handler) == 1)
^
1 warning generated.
compiling xslt_stylesheet.c
xslt_stylesheet.c:141:30: warning: cast from 'const char *' to 'char *' drops const qualifier [-Wcast-qual]
rb_scan_args(argc, argv, "11", &xmldoc, &paramobj);
^
xslt_stylesheet.c:112:13: warning: unused function 'swallow_superfluous_xml_errors' [-Wunused-function]
static void swallow_superfluous_xml_errors(void * userdata, xmlErrorPtr error, ...)
^
2 warnings generated.
linking shared-object nokogiri/nokogiri.bundle
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
ld: warning: directory not found for option '-L/usr/local/opt/zlib/lib'
Cleaning files only used during build.
rm -rf /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri/tmp/x86_64-apple-darwin17.7.0/ports
rm -rf /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ports
current directory: /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10/ext/nokogiri
make "DESTDIR=" install
make: /usr/local/opt/coreutils/bin/gmkdir: No such file or directory
make: *** [.sitearchdir.-.nokogiri.time] Error 1
make install failed, exit code 2
Gem files will remain installed in /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.10 for inspection.
Results logged to /Users/michaelnavoy/.rvm/gems/ruby-2.6.1/extensions/x86_64-darwin-17/2.6.0/nokogiri-1.10.10/gem_make.out

我已经尝试了几个修复提供给其他安装nokogiri有问题的人,包括:

gem uninstall nokogiri
xcode-select --install
gem install nokogiri

gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/libxml2/

这似乎解决了大多数用户的问题。我还查阅了https://nokogiri.org/tutorials/installing_nokogiri.html关于Mac安装没有任何作用。这个问题需要解决,然后我才能安装rails-gem。

如有任何帮助,我们将不胜感激。想法?

使用Catalina 10.15.5

感谢

我在谷歌翻译的日语页面上找到了一个使用自制软件的解决方案:
https://qiita.com/takeru56/items/9dc2b2aec56aaed69740

下载并安装自制程序
https://docs.brew.sh/Installation

然后安装coreutils:

$ brew install coreutils
==> Downloading https://homebrew.bintray.com/bottles/coreutils-8.32.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/67a4452d75a1882bd7fb977b384204edfa2758276d66290e595487922368e
######################################################################## 100.0%
==> Pouring coreutils-8.32.catalina.bottle.tar.gz
==> Caveats
Commands also provided by macOS have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
==> Summary
🍺  /usr/local/Cellar/coreutils/8.32: 476 files, 9.2MB

然后我成功地安装了nokogiri:

$ gem install nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.10
1 gem installed 

相关内容

  • 没有找到相关文章

最新更新