Skip to content

Installing charlock holmes and libicu dev on heroku

Gabriel Sobrinho edited this page Jul 24, 2015 · 5 revisions

These instructions assumes that you are using Celadon Cedar-14 Stack, see here for instructions how to upgrade if you aren't already using it.

You need to use heroku-buildpack-multi and combine 3 buildpacks using .buildpacks:

https://github.com/ddollar/heroku-buildpack-apt
https://github.com/timolehto/heroku-bundle-config
https://github.com/heroku/heroku-buildpack-ruby

heroku-buildpack-apt allows you to create a Aptfile which will install these packages using apt-get:

http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu48_4.8.1.1-3ubuntu0.5_amd64.deb
http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu-dev_4.8.1.1-3ubuntu0.5_amd64.deb

heroku-bundle-config allows you to overwrite the bundler config using .heroku-bundle/config, which we will use to instruct charlock holmes the location of libicu-dev:

---
BUNDLE_FROZEN: '1'
BUNDLE_PATH: vendor/bundle
BUNDLE_BIN: vendor/bundle/bin
BUNDLE_JOBS: 4
BUNDLE_WITHOUT: development:test
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_BUILD__CHARLOCK_HOLMES: --with-icu-lib=/app/.apt/usr/lib/x86_64-linux-gnu --with-icu-include=/app/.apt/usr/include/x86_64-linux-gnu

Using that combination, you can just use the official gem version on Gemfile:

gem 'charlock_holmes'

That's it!

Credits to Steeve Tooke and Matt Brown, see here.