【问题标题】:An error occurred while installing nokogiri (1.10.10), and Bundler cannot continue安装 nokogiri (1.10.10) 时出错,Bundler 无法继续
【发布时间】:2021-06-25 11:26:34
【问题描述】:
  • 操作系统:Ubuntu 18.04
  • 红宝石:2.7
  • 导轨:6.*

Gem::Ext::BuildError: ERROR: 未能构建 gem 原生扩展。

current directory: /home/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.10.10/ext/nokogiri

/home/.rvm/rubies/ruby-2.7.0/bin/ruby -I /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0 -r ./siteconf20210329-30335-1ed7nme.rb extconf.rb --use-system-libraries 检查 C 编译器是否接受 ... *** extconf.rb 失败 *** 由于某种原因无法创建 Makefile, 可能缺少必要的库和/或头文件。检查 mkmf.log 文件以获取更多详细信息。您可能需要配置选项。

提供的配置选项:--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=/home/.rvm/rubies/ruby-2.7.0/bin/$(RUBY_BASE_NAME) --help --clean /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:471:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:597:in block in try_compile' 来自 /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:544:in with_werror' from /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:597:in try_compile' 来自 extconf.rb:138:in nokogiri_try_compile' from extconf.rb:162:in block in add_cflags' 来自 /home/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/mkmf.rb:655:in with_cflags' from extconf.rb:161:in add_cflags' 来自 extconf.rb:416:in `'

要查看此扩展无法编译的原因,请查看 mkmf.log 可以在这里找到:

/home/.rvm/gems/ruby-2.7.0/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/mkmf.log

extconf 失败,退出代码 1

Gem 文件将继续安装在 /home/.rvm/gems/ruby-2.7.0/gems/nokogiri-1.10.10 进行检查。 结果记录到 /home/.rvm/gems/ruby-2.7.0/extensions/x86_64-linux/2.7.0/nokogiri-1.10.10/gem_make.out

安装 nokogiri (1.10.10) 和 Bundler 时出错 无法继续。在捆绑之前确保gem install nokogiri -v '1.10.10' --source 'https://rubygems.org/' 成功。

【问题讨论】:

    标签: ruby-on-rails nokogiri


    【解决方案1】:

    首先,检查您的 mkmf.log 文件以了解更多详细信息。

    gcc: error: unrecognized command line option '-Wduplicated-cond'
    gcc: error: unrecognized command line option '-Wmisleading-indentation'
    gcc: error: unrecognized command line option '-Wimplicit-fallthrough=0'
    

    解决方案:brew unlink gcc

    $ bundle install (会正常工作)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-07
      • 2016-03-14
      • 2022-01-20
      • 2017-02-09
      • 2018-09-08
      • 2020-01-16
      • 2014-01-12
      • 2018-04-05
      相关资源
      最近更新 更多