简体   繁体   English

无法在 Mac OS catalina 上安装 uchardet gem

[英]Cannot install uchardet gem on Mac OS catalina

Recently I got the following errors when I tried to install the uchardet GEM in MacOS catalina,Even I specific the ICU version and lib, it still doesn't work, anyone have ideas?最近在 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

I was able to reproduce this on my mac:我能够在我的 Mac 上重现它:

I fixed this error by re-installing and re-linking icu4c我通过重新安装和重新链接icu4c修复了这个错误

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

restarted my terminal then re-installed the gem (i also tried this )重新启动我的终端然后重新安装 gem(我也试过这个

you will know it's working when you have which icu-config working https://github.com/dmgk/uchardet/blob/506105c5322fe3cde7ce3e2b2868f875b9b57230/ext/extconf.rb#L3-L6当您拥有which icu-config 工作时,您就会知道它正在工作

however now i have another error uchardet.c:2:10: fatal error: 'unicode/ucsdet.h' file not found i do think the gems needs better configuration around this但是现在我有另一个错误uchardet.c:2:10: fatal error: 'unicode/ucsdet.h' file not found我确实认为 gems 需要更好的配置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM