【问题标题】:Cannot install uchardet gem on Mac OS catalina无法在 Mac OS catalina 上安装 uchardet gem
【发布时间】:2021-04-12 09:38:14
【问题描述】:

最近我在MacOS catalina中安装uchardet GEM时遇到以下错误,即使我指定了ICU版本和lib,它仍然不起作用,有人有想法吗?

Installing uchardet 0.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0/ext
/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/ruby -I /Users/xxx/.rvm/rubies/ruby-2.6.4/lib/ruby/site_ruby/2.6.0 -r ./siteconf20200420-38494-q9y0cf.rb extconf.rb
Could not find ICU libraries and/or development tools. Try installing "icu-devtools" or "icu" package.
*** 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
    --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=/Users/xxx/.rvm/rubies/ruby-2.6.4/bin/$(RUBY_BASE_NAME)

extconf failed, exit code 1

Gem files will remain installed in /Users/xxx/.rvm/gems/ruby-2.6.4/gems/uchardet-0.2.0 for inspection.
Results logged to /Users/xxx/.rvm/gems/ruby-2.6.4/extensions/x86_64-darwin-19/2.6.0/uchardet-0.2.0/gem_make.out

【问题讨论】:

  • 您是否安装了 Xcode 及其命令行工具?

标签: ruby-on-rails ruby rubygems


【解决方案1】:

我能够在我的 Mac 上重现这个:

我通过重新安装和重新链接icu4c修复了这个错误

brew install icu4c
brew link icu4c --force # if it shows you an error and tells you to add the path manually add them

重新启动我的终端,然后重新安装 gem(我也是 tried this)

当你有 which icu-config 工作 https://github.com/dmgk/uchardet/blob/506105c5322fe3cde7ce3e2b2868f875b9b57230/ext/extconf.rb#L3-L6 时,你就会知道它正在工作

但是现在我有另一个错误uchardet.c:2:10: fatal error: 'unicode/ucsdet.h' file not found 我确实认为 gems 需要更好的配置来解决这个问题

【讨论】:

    猜你喜欢
    • 2021-06-23
    • 1970-01-01
    • 2020-05-11
    • 2017-12-17
    • 1970-01-01
    • 1970-01-01
    • 2020-02-28
    • 2012-02-04
    • 1970-01-01
    相关资源
    最近更新 更多