我在 Rails 4 应用程序中使用 ruby gem charlock_holmes来检测我正在解析的 CSV 的字符编码,这样CSV.foreach
就不会引发错误。
但是,当我尝试推送到 heroku(gem 'charlock_holmes'
在 Gemfile 中)时,我收到以下错误:
Installing charlock_holmes (0.6.9.4)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/tmp/build_e741f6ed-a860-47bf-8c0d-1b678fa0ebeb/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for main() in -licui18n... no
checking for main() in -licui18n... no
***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** 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=/tmp/build_e741f6ed-a860-47bf-8c0d-1b678fa0ebeb/vendor/ruby-2.0.0/bin/ruby
--with-icu-dir
--without-icu-dir
--with-icu-include
--without-icu-include=${icu-dir}/include
--with-icu-lib
--without-icu-lib=${icu-dir}/
--with-icui18nlib
--without-icui18nlib
--with-icui18nlib
--without-icui18nlib
Gem files will remain installed in /tmp/build_e741f6ed-a860-47bf-8c0d-1b678fa0ebeb/vendor/bundle/ruby/2.0.0/gems/charlock_holmes-0.6.9.4 for inspection.
Results logged to /tmp/build_e741f6ed-a860-47bf-8c0d-1b678fa0ebeb/vendor/bundle/ruby/2.0.0/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/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.
如何libicu-dev
在 Heroku 上安装?