Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install charlock_holmes dependency libicu-dev on Heroku

I'm using the ruby gem charlock_holmes in a Rails 4 app to detect the character encodings of CSV's that I'm parsing so that CSV.foreach doesn't throw an error.

However, when I try to push to heroku (with gem 'charlock_holmes' in the Gemfile) I get the following error:

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.

How do I get libicu-dev to install on Heroku?

like image 423
silasjmatson Avatar asked Sep 20 '13 22:09

silasjmatson


1 Answers

Try using gem "charlock_holmes_bundle_icu", "~> 0.6.9.2". More info.

like image 167
Ryan Linton Avatar answered Oct 14 '22 10:10

Ryan Linton