当前位置: 首页 > 知识库问答 >
问题:

ruby nokogiri宝石安装mac osx high sierra

韦高格
2023-03-14

试图用新的红宝石在我的OSX高塞拉(新鲜安装)做捆绑安装,它一直在这个nokogiri宝石上失败。以下是错误日志:

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

    current directory: /Library/Ruby/Gems/2.3.0/gems/nokogiri-
    1.8.1/ext/nokogiri
    /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r 
    ./siteconf20171021-88037-tq6xex.rb extconf.rb
    checking if the C compiler accepts ... 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.3.0
    checking for iconv.h... yes
    checking for gzdopen() in -lz... yes
    checking for iconv... yes

 ************************************************************************
    IMPORTANT NOTICE:

    Building Nokogiri with a packaged version of libxml2-2.9.5.

    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.5.tar.gz into tmp/x86_64-apple-
    darwin17/ports/libxml2/2.9.5... OK
    Running 'configure' for libxml2 2.9.5... OK
    Running 'compile' for libxml2 2.9.5... ERROR, review 
    '/Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri/tmp/x86_64-
    apple-darwin17/ports/libxml2/2.9.5/compile.log' to see what happened. 
    Last lines are:
========================================================================
    CCLD     libxml2.la
    CC       testdso.lo
    CCLD     testdso.la
    CC       xmllint.o
    CCLD     xmllint
    ld: warning: ignoring file 
    /usr/local/Cellar/xz/5.2.2/lib/liblzma.dylib, file was built for x86_64 
    which is not the architecture being linked (i386): 
    /usr/local/Cellar/xz/5.2.2/lib/liblzma.dylib
    Undefined symbols for architecture i386:
    "_lzma_auto_decoder", referenced from:
      _xz_head in libxml2.a(xzlib.o)
    "_lzma_code", referenced from:
      _xz_decomp in libxml2.a(xzlib.o)
    "_lzma_end", referenced from:
      ___libxml2_xzclose in libxml2.a(xzlib.o)
    "_lzma_properties_decode", referenced from:
      _is_format_lzma in libxml2.a(xzlib.o)
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see 
    invocation)
    make[2]: *** [xmllint] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
========================================================================
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of 
    necessary
    libraries and/or headers.  Check the mkmf.log file for more details.  
    You may need configuration options.

    Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --
 ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
    /Library/Ruby/Gems/2.3.0/gems/mini_portile2-
    2.3.0/lib/mini_portile2/mini_portile.rb:402:in `block in execute': 
    Failed to complete compile task (RuntimeError)
    from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-
    2.3.0/lib/mini_portile2/mini_portile.rb:373:in `chdir'
    from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-
    2.3.0/lib/mini_portile2/mini_portile.rb:373:in `execute'
    from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-
    2.3.0/lib/mini_portile2/mini_portile.rb:115:in `compile'
    from /Library/Ruby/Gems/2.3.0/gems/mini_portile2-
    2.3.0/lib/mini_portile2/mini_portile.rb:154:in `cook'
    from extconf.rb:365:in `block (2 levels) in process_recipe'
    from extconf.rb:257:in `block in chdir_for_build'
    from extconf.rb:256:in `chdir'
    from extconf.rb:256:in `chdir_for_build'
    from extconf.rb:364:in `block in process_recipe'
    from extconf.rb:262:in `tap'
    from extconf.rb:262:in `process_recipe'
    from extconf.rb:548:in `'

    To see why this extension failed to compile, please check the mkmf.log 
    which can be found here:

    /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/nokogiri-
    1.8.1/mkmf.log

    extconf failed, exit code 1

    Gem files will remain installed in 
    /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.1 for inspection.
    Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-
    17/2.3.0/nokogiri-1.8.1/gem_make.out

共有3个答案

姜华翰
2023-03-14

这是唯一对我有用的东西:

bundle config build.nokogiri --use-system-libraries \ --with-xml2-include=$(brew --prefix libxml2)/include/libxml2

然后捆绑安装

慕容齐智
2023-03-14

我发现与xz库存在冲突,使用以下方法解决:

brew unlink xz
sudo gem install nokogiri
brew link xz

来源:Nokogiri错误报告-无法在Mac OS 10.13上安装Nokogiri

令狐宣
2023-03-14

gem安装nokogiri----use系统库=true--with-xml2-包括=/应用程序/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2/

确保已安装xcode

 类似资料:
  • 我得到这个信息: 安装rake时出错 我应该如何继续修复此错误?

  • 在我的docker服务器上,我在sidekiq/redis URL-URL-Sespecification上出错: 我明白了 URI::InvalidURIError:方案redis不接受注册表部分:bsc\u redis:6379(或错误的主机名?)来自/usr/local/lib/ruby/2.0.0/uri/generic。rb:214:innew'from/usr/local/lib/ru

  • 《稳定宝石放置》一款以宝石为主题的放置游戏,通过控制不同的升级,来获得各种宝石,购买升级,最终通关游戏。

  • 我正在使用Chef solo、Berkshelf和Vagrant来尝试构建一个开发环境。我还有其他的菜谱,但是“chef rvm”菜谱给我安装ruby版本带来了麻烦。 要明确的是,RVM正在安装,但当我在vbox中输入“vagrant ssh”并键入“RVM list”时,它表示没有安装rubies。我可以输入“rvm install 2.1.1”,它可以工作,所以我不确定Chef为什么不安装它。

  • 对于一个电子商务应用程序,我试图将选项的散列(每个选项都有一个选择数组)转换为表示这些选择组合的散列数组。例如: 输入内部可能有其他选项,每个选项的选项数量不确定,但它只会嵌套 1 级深。任何

  • 我正在使用Ruby和Selenium web驱动程序测试一个webapp。我无法检查显示网页中单元格的内容。我想要的是td中的IP。 我使用Firefox插件firepath获取IP的Xpath。它给出了“html/body/div[1]/div[2]/div[3]/form/table/tbody/tr[1]/td[6]/ul/li”,看起来是正确的。 但是我无法显示IP。这是我的测试代码; 把