Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install 'charlock_holmes_bundle_icu' on Mavericks #49

Closed
silasjmatson opened this issue Oct 23, 2013 · 16 comments
Closed

Unable to install 'charlock_holmes_bundle_icu' on Mavericks #49

silasjmatson opened this issue Oct 23, 2013 · 16 comments

Comments

@silasjmatson
Copy link

I get the following error when trying to install on OS X Mavericks:

Installing charlock_holmes_bundle_icu (0.6.9.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /opt/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
  -- tar zxvf icu4c-49_1_2-src.tgz
  -- LDFLAGS= CXXFLAGS="-O2 -fPIC" CFLAGS="-O2 -fPIC" ./configure --prefix=/Users/silasjmatson/.gem/ruby/2.0.0/gems/charlock_holmes_bundle_icu-0.6.9.2/ext/charlock_holmes/dst/ --disable-tests --disable-samples --disable-icuio --disable-extras --disable-layout --enable-static --disable-shared
  -- make install
*** 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=/opt/rubies/ruby-2.0.0-p247/bin/ruby
extconf.rb:7:in `sys': make install failed, please report issue on http://github.com/brianmario/charlock_holmes (RuntimeError)
    from extconf.rb:33:in `block (2 levels) in <main>'
    from extconf.rb:31:in `chdir'
    from extconf.rb:31:in `block in <main>'
    from extconf.rb:27:in `chdir'
    from extconf.rb:27:in `<main>'


Gem files will remain installed in /Users/silasjmatson/.gem/ruby/2.0.0/gems/charlock_holmes_bundle_icu-0.6.9.2 for inspection.
Results logged to /Users/silasjmatson/.gem/ruby/2.0.0/gems/charlock_holmes_bundle_icu-0.6.9.2/ext/charlock_holmes/gem_make.out

An error occurred while installing charlock_holmes_bundle_icu (0.6.9.2), and Bundler cannot continue.
Make sure that `gem install charlock_holmes_bundle_icu -v '0.6.9.2'` succeeds before bundling.
@silasjmatson
Copy link
Author

Here's a gist of the mkmf.log. https://gist.github.com/silasj/7bbe41bcb76ca3c91566

@tooky
Copy link

tooky commented Oct 23, 2013

Also seeing this, I guess it's the same upstream icu issue as Homebrew/legacy-homebrew#20545

@silasjmatson
Copy link
Author

Possibly, but I can install icu4c with homebrew without issue.

@tooky
Copy link

tooky commented Oct 24, 2013

@silasj homebrew has updated the version of icu. You can use the version of this gem from my pull request by adding this to your Gemfile

gem 'charlock_holmes', github: "tooky/charlock_holmes", branch: "bundle-icu"

@silasjmatson
Copy link
Author

Thanks! This'll definitely help.

@stepheneb
Copy link

@tooky, I'm on 10.9 and am trying to use your fork of charlock_holmes and having a strange problem -- it appears to install correctly using bundler but the gem isn't available.

I added the following to my Gemfile:

gem 'charlock_holmes', github: "tooky/charlock_holmes", branch: "bundle-icu"

And running bundle install I see it getting installed:

Using charlock_holmes (0.6.13) from git://github.com/tooky/charlock_holmes.git (at bundle-icu) from /Users/stephen/.rvm/gems/ruby-2.0.0-p247@lab/bundler/gems/charlock_holmes-f2ac0461f393/charlock_holmes.gemspec 

The bundle install command appears to complete without error and I can list charlock_holmes with bundle:

$ bundle list charlock_holmes
/Users/stephen/.rvm/gems/ruby-2.0.0-p247@lab/bundler/gems/charlock_holmes-f2ac0461f393

But if I look for charlock_holmes with the gem command it isn't there:

$ gem list charlock_holmes

*** LOCAL GEMS ***

And I can't require it:

$ ruby -e 'require "charlock_holmes"'
/Users/stephen/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require': cannot load such file -- charlock_holmes (LoadError)
    from /Users/stephen/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
    from -e:1:in `<main>'

stepheneb added a commit to labframework/lab that referenced this issue Nov 22, 2013
Use simple command-line git invocations in following
scripts instead of grit fork.

  ./script/generate-js-version.rb
  ./script/update-git-commit-and-branch.rb

gitlab-grit dependency charlock_holmes not working
correctly in Mac OS X 10.9

see: brianmario/charlock_holmes#49
@tooky
Copy link

tooky commented Nov 23, 2013

It's being installed by bundler so you will need to use bundler to access
it:

e.g.

bundle show charlock_holmes

or

bundle exec ruby -e 'require "charlock_holmes"

On 22 November 2013 16:18, Stephen Bannasch notifications@github.comwrote:

@tooky https://github.com/tooky, I'm on 10.9 and am trying to use your
fork of charlock_holmes and having a strange problem -- it appears to
install correctly using bundler but the gem isn't available.

I added the following to my Gemfile:

gem 'charlock_holmes', github: "tooky/charlock_holmes", branch: "bundle-icu"

And running bundle install I see it getting installed:

Using charlock_holmes (0.6.13) from git://github.com/tooky/charlock_holmes.git (at bundle-icu) from /Users/stephen/.rvm/gems/ruby-2.0.0-p247@lab/bundler/gems/charlock_holmes-f2ac0461f393/charlock_holmes.gemspec

The bundle install command appears to complete without error and I can
list charlock_holmes with bundle:

$ bundle list charlock_holmes
/Users/stephen/.rvm/gems/ruby-2.0.0-p247@lab/bundler/gems/charlock_holmes-f2ac0461f393

But if I look for charlock_holmes with the gem command it isn't there:

$ gem list charlock_holmes

*** LOCAL GEMS ***

And I can't require it:

$ ruby -e 'require "charlock_holmes"'
/Users/stephen/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in require': cannot load such file -- charlock_holmes (LoadError) from /Users/stephen/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:inrequire'
from -e:1:in `

'


Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-29085306
.

Steve Tooke :: heavi.es
+44 7919 337 463 :: +44 20 8133 4134
skype:stevetooke :: twitter.com/tooky

Heavies Limited
Registered Number: 7612561
Registered Address: Parmenter House, 57 Tower Street, Winchester SO23 8TD

@webandtech
Copy link

Instead of using the bundle_icu gem, I just created a custom buildback with icu4c installed. It is a fork off of the latest heroku-buildpack-ruby (default ruby buildpack). Anyone who wants to use it is welcome. I will try to keep it updated with the latest from the main fork.

Using a custom buildpack versus the bundle_icu gem has many advantages, namely, faster deploy times, and a small slug.

  1. Install the heroku buildpack CLI: $ heroku plugins:install https://github.com/heroku/heroku-buildpacks
  2. Set the buildpack to my fork (Frederick is the org): $ heroku buildpacks:set frederick/heroku-buildpack-ruby -a myapp
  3. In your Gemfile, use: gem 'charlock_holmes'
  4. To run in OSX, you'll probably first need to: $ brew install icu4c

geoff-nixon pushed a commit to pullreq/charlock_holmes that referenced this issue Dec 12, 2013
This pull request includes changes intended to allow the resolution of brianmario#29, brianmario#40, brianmario#42 (partial), brianmario#43, brianmario#49, brianmario#50, brianmario#51, brianmario#52.

- file/libmagic (and patch) updated to 5.16.
- extconf.rb modified to:
  - enforce RbConfig compiler and related flags.
  - fix for non-GNU 'make' (ie, no ```make -C```).
  - remove 'dst' build directory after compiling.
  - **Build and link against system ICU on Darwin.**
    I've included a minimal subset of the ICU headers in ```darwin-icu-headers.tar.gz```,
    taken from the [Apple ICU](http://www.opensource.apple.com/source/ICU/ICU-461.18) source (Apple doesn't distribute these headers because they prefer you use their client frameworks like Core Text, etc., but they're available freely at the link above). These headers are from the version bundled with 10.7 (10.6 was too old, so I've retained the check for homebrew icu4c on older versions).

    I've tested that they work on 10.9, so presumably it should work on 10.7 and 10.8 as well.
    If anyone can confirm that, that would be great.

    I think perhaps this is a better solution than relying on ```brew install icu4c```?
geoff-nixon pushed a commit to pullreq/charlock_holmes that referenced this issue Dec 13, 2013
This pull request includes changes intended to allow the resolution of brianmario#29, brianmario#40, brianmario#42 (partial), brianmario#43, brianmario#49, brianmario#50, brianmario#51, brianmario#52.

- file/libmagic (and patch) updated to 5.16.
- extconf.rb modified to:
  - enforce RbConfig compiler and related flags.
  - fix for non-GNU 'make' (ie, no ```make -C```).
  - remove 'dst' build directory after compiling.
  - **Build and link against system ICU on Darwin.**
    I've included a minimal subset of the ICU headers in ```darwin-icu-headers.tar.gz```,
    taken from the [Apple ICU](http://www.opensource.apple.com/source/ICU/ICU-461.18) source (Apple doesn't distribute these headers because they prefer you use their client frameworks like Core Text, etc., but they're available freely at the link above). These headers are from the version bundled with 10.7 (10.6 was too old, so I've retained the check for homebrew icu4c on older versions).

    I've tested that they work on 10.9, so presumably it should work on 10.7 and 10.8 as well.
    If anyone can confirm that, that would be great.

    I think perhaps this is a better solution than relying on ```brew install icu4c```?
@silasjmatson
Copy link
Author

@webandtech I've been using your custom buildpack for a while now, and it's been working great, but today my deployments started failing with the following error:

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

       /tmp/build_675a5af6-cdae-4c80-a4cf-c961617d8da8/vendor/ruby-2.1.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_675a5af6-cdae-4c80-a4cf-c961617d8da8/vendor/ruby-2.1.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}/lib
       --with-icui18nlib
       --without-icui18nlib
       --with-icui18nlib
       --without-icui18nlib

       extconf failed, exit code 1

       Gem files will remain installed in /tmp/build_675a5af6-cdae-4c80-a4cf-c961617d8da8/vendor/bundle/ruby/2.1.0/gems/charlock_holmes-0.6.9.4 for inspection.
       Results logged to /tmp/build_675a5af6-cdae-4c80-a4cf-c961617d8da8/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/charlock_holmes-0.6.9.4/gem_make.out

@webandtech
Copy link

@silasj Sorry about that. I didn't know anyone was using it and updated it to try something else.

I rolled it back, so you should be all set. I have decided to stop maintaining this though, so you may want to make your own or take another approach eventually. Personally, I have started to deploy with jruby and had to move to a java version - icu4j.

@silasjmatson
Copy link
Author

@webandtech No worries.

I've never worked with a custom buildpack. Do I just fork yours and push the buildpack to heroku?

@benjie
Copy link

benjie commented Mar 26, 2014

@silasj since @webandtech is not maintaining his fork any more (and who can blame him?!) I've come up with a new method which should be virtually maintenance free - always using the up to date heroku-buildpack-ruby and doesn't require vendoring your binaries (instead they're installed from apt-get). Details are in this StackOverflow post but basically use heroku-buildpack-multi with the following .buildpacks and libicu-dev in your Aptfile:

https://github.com/benjie/heroku-buildpack-apt
https://github.com/heroku/heroku-buildpack-ruby

@geoff-nixon
Copy link

@benjie I don't care (myself) one bit — not my project — but can I just double check (for sake of my own ignorance), the last few posts have made the jump from a Heroku build-pack which could also be used on Mac OS X to being purely about Heroku correct?

I make mention of it just since (as it seems you've found a nice solution for that problem), perhaps create a separate PR/issue, simply because anyone looking for your solution are unlikely to look 12 posts down on an issue called Unable to install 'charlock_holmes_bundle_icu' on Mavericks, I think? 🍻 😀

@silasjmatson
Copy link
Author

@g--n I agree. This issue has kinda wandered across several topics that, while somewhat related, the solutions aren't very discoverable.

@benjie
Copy link

benjie commented Mar 26, 2014

@g--n @silasj Though I agree in principle, this thread is the third hit on google (for me) for heroku libicu-dev charlock_holmes.

@webandtech
Copy link

@silasjmatson @benjie FYI I decided to rebase my buildpack from the latest heroku buildpack and I will maintain it as I'm able. The fork is also available at https://github.com/webandtech/heroku-buildpack-ruby

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants