Gem Mac 下 bundle 安装 ‘charlock_holmes’ 各种失败,求指导

ShayneChow · 2014年10月10日 · 最后由 saiga 回复于 2014年10月10日 · 5783 次阅读
#系统环境:
OS X 10.9.5
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin13.1.0]
Rails 4.0.4

BTW:服务器环境可以正常安装(Ubuntu)

Google 了一下午,愣装不上啊,愁! 有说是 bundle 的 bug 的,有说是 charlock_holmes 在 64 位系统的 bug,有说需要依赖 icu4c 的……

记得之前也有这个问题,不知道怎么处理了一下好了一阵子,现在又出现。

icu4c-53.1 already installed 由 brew 管理

Gemfile 里是

# 读取 csv/excel
gem 'roo', git: 'https://github.com/Empact/roo.git'

#gem 'charlock_holmes', git: 'https://github.com/brianmario/charlock_holmes.git'
#gem 'charlock_holmes', '~> 0.6.9.4'

大家看到的,各个版本均尝试了 结果如下:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/bin/ruby extconf.rb --with-icu-dir=/usr/local/opt/icu4c
checking for main() in -licui18n... *** 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/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/bin/ruby
    --with-icu-dir
    --with-icu-include
    --without-icu-include=${icu-dir}/include
    --with-icu-lib
    --without-icu-lib=${icu-dir}/
    --with-icui18nlib
    --without-icui18nlib
/Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:720:in `try_func'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:950:in `block in have_library'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
    from /Users/ShayneChow/.rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/mkmf.rb:945:in `have_library'
    from extconf.rb:27:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/ShayneChow/.rvm/gems/ruby-2.0.0-p451@global/gems/charlock_holmes-0.6.9.4 for inspection.
Results logged to /Users/ShayneChow/.rvm/gems/ruby-2.0.0-p451@global/extensions/x86_64-darwin-13/2.0.0/charlock_holmes-0.6.9.4/gem_make.out
An error occurred while installing charlock_holmes (0.6.9.4), and Bundler cannot continue.
Make sure that `gem install charlock_holmes -v '0.6.9.4'` succeeds before bundling.

跪求解决方案

@saiga 上次也有咨询过你的,再来看看

太久远了,我都忘光了...

README 看看:https://github.com/brianmario/charlock_holmes#homebrew

#2 楼 @saiga 都看几遍了,这些方法都试过,解决不了

试试升级一下 icu,顺便检查一下 /usr/local/opt/icu4c

brew update
brew install icu4c --HEAD
需要 登录 后方可回复, 如果你还没有账号请 注册新账号