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

Bundle icu4c #4

Closed
wants to merge 2 commits into from
Closed

Bundle icu4c #4

wants to merge 2 commits into from

Conversation

josh
Copy link
Contributor

@josh josh commented Oct 14, 2011

The extra setup steps are getting to me now. Really, really don't want to have to remember to brew install icu4c again. Its also breaking my travis builds. :(

Another approach would be to spin off a libicu gem for just the source. We could also attempt binary builds that way as well.

/cc @brianmario @tmm1 @rtomayko @tanoku

@brianmario
Copy link
Owner

fwiw you can add this to your .travis.yml too:

before_script:
  - "apt-get install libicu-dev"

But, I'd still like to get around having to install it :)

@weppos
Copy link

weppos commented Oct 26, 2011

I'm really interested in this topic. I'm trying to install the Gem on Heroku, where unfortunately the libicu-dev library is not available.

Just to let you know, I tried with this branch but it's still raising an error.

Using charlock_holmes (0.6.8) from https://github.com/brianmario/charlock_holmes.git (at bundle-icu) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/bin/ruby extconf.rb
-- tar zxvf icu4c-4_8_1-src.tgz
-- ./configure --prefix=/tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/bundler/gems/charlock_holmes-0fa4d3ff22e3/ext/charlock_holmes/dst/ --disable-tests --disable-samples --disable-icuio --disable-extras --disable-layout --enable-static
-- make install
checking for main() in -licui18n... no
***************************************************************************************
********* error compiling and linking icu4c. please report issue on github *********
***************************************************************************************
*** 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=/usr/local/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
Gem files will remain installed in /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/bundler/gems/charlock_holmes-0fa4d3ff22e3 for inspection.
Results logged to /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/bundler/gems/charlock_holmes-0fa4d3ff22e3/ext/charlock_holmes/gem_make.out
from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each'
from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:443:in `generate_bin'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/source.rb:564:in `install'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:73:in `block in install_gem_from_spec'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:72:in `install_gem_from_spec'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:56:in `block in run'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:in `run'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/installer.rb:12:in `install'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/cli.rb:219:in `install'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:in `run'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/lib/bundler/vendor/thor/base.rb:386:in `start'
from /tmp/build_22v1vaioxw0z6/vendor/bundle/ruby/1.9.1/gems/bundler-1.1.rc/bin/bundle:13:in `<top (required)>'
from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `load'
from vendor/bundle/ruby/1.9.1/bin/bundle:19:in `<main>'

@josh
Copy link
Contributor Author

josh commented Oct 26, 2011

Good point. We really want this to help support heroku.

@josh
Copy link
Contributor Author

josh commented Nov 9, 2011

I can't seem to get to work anymore.

$ bundle exec rake
/Users/josh/.rbenv/versions/1.9.3-p0/bin/ruby -I. ../../../../ext/charlock_holmes/extconf.rb
  -- tar zxvf icu4c-4_8_1-src.tgz
  -- ./configure --prefix=/Volumes/Scratch/charlock_holmes/ext/charlock_holmes/dst/ --disable-tests --disable-samples --disable-icuio --disable-extras --disable-layout --enable-static
  -- make install
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
  -- tar zxvf file-5.08.tar.gz
  -- ./configure --prefix=/Volumes/Scratch/charlock_holmes/ext/charlock_holmes/dst/ --disable-shared --enable-static --with-pic
  -- make -C src install
  -- make -C magic install
checking for main() in -lmagic_ext... yes
checking for magic.h... yes
creating Makefile
make
compiling ../../../../ext/charlock_holmes/converter.c
../../../../ext/charlock_holmes/converter.c: In function ‘rb_converter_convert’:
../../../../ext/charlock_holmes/converter.c:19: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../../ext/charlock_holmes/converter.c:7: warning: unused parameter ‘self’
../../../../ext/charlock_holmes/converter.c: At top level:
../../../../ext/charlock_holmes/common.h:24: warning: ‘charlock_new_str’ defined but not used
../../../../ext/charlock_holmes/common.h:33: warning: ‘charlock_new_str2’ defined but not used
compiling ../../../../ext/charlock_holmes/encoding_detector.c
../../../../ext/charlock_holmes/encoding_detector.c: In function ‘rb_encdec_detect’:
../../../../ext/charlock_holmes/encoding_detector.c:100: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../../ext/charlock_holmes/encoding_detector.c: In function ‘rb_encdec_detect_all’:
../../../../ext/charlock_holmes/encoding_detector.c:149: warning: implicit conversion shortens 64-bit value into a 32-bit value
../../../../ext/charlock_holmes/encoding_detector.c: At top level:
../../../../ext/charlock_holmes/common.h:15: warning: ‘charlock_new_enc_str’ defined but not used
compiling ../../../../ext/charlock_holmes/ext.c
../../../../ext/charlock_holmes/common.h:15: warning: ‘charlock_new_enc_str’ defined but not used
../../../../ext/charlock_holmes/common.h:24: warning: ‘charlock_new_str’ defined but not used
../../../../ext/charlock_holmes/common.h:33: warning: ‘charlock_new_str2’ defined but not used
linking shared-object charlock_holmes/charlock_holmes.bundle
/Users/josh/.rbenv/versions/1.9.3-p0/bin/ruby -S bundle exec rspec ./spec/converter_spec.rb ./spec/encoding_detector_spec.rb ./spec/string_method_spec.rb
/Volumes/Scratch/charlock_holmes/lib/charlock_holmes.rb:1:in `require': dlopen(/Volumes/Scratch/charlock_holmes/lib/charlock_holmes/charlock_holmes.bundle, 9): Library not loaded: libicui18n.48.dylib (LoadError)
  Referenced from: /Volumes/Scratch/charlock_holmes/lib/charlock_holmes/charlock_holmes.bundle
  Reason: image not found - /Volumes/Scratch/charlock_holmes/lib/charlock_holmes/charlock_holmes.bundle
    from /Volumes/Scratch/charlock_holmes/lib/charlock_holmes.rb:1:in `<top (required)>'
    from /Volumes/Scratch/charlock_holmes/spec/spec_helper.rb:3:in `require'
    from /Volumes/Scratch/charlock_holmes/spec/spec_helper.rb:3:in `<top (required)>'
    from /Volumes/Scratch/charlock_holmes/spec/converter_spec.rb:3:in `require'
    from /Volumes/Scratch/charlock_holmes/spec/converter_spec.rb:3:in `<top (required)>'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
    from /Users/josh/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'
rake aborted!
ruby -S bundle exec rspec ./spec/converter_spec.rb ./spec/encoding_detector_spec.rb ./spec/string_method_spec.rb failed

Tasks: TOP => default => spec
(See full trace by running task with --trace)

@josh josh closed this Nov 27, 2011
@jch
Copy link

jch commented Aug 6, 2012

@josh did you come up with a solution, or did you just package it with a pre-built binary? I'm trying to get this working on heroku.

@josh
Copy link
Contributor Author

josh commented Aug 6, 2012

@jch never figured it out. PDI :D

@jch
Copy link

jch commented Aug 6, 2012

@josh 💩, thanks anyways

@juliamae
Copy link

juliamae commented Oct 3, 2012

This is still uninstallable on Heroku, which is a bummer since http://github.com/github/linguist depends on it. @jch, did you figure anything out?

@jch
Copy link

jch commented Oct 3, 2012

@juliamae haven't looked at it again. At some point, I'll need to take a look again since https://github.com/github/github-html uses linguist and I'm working on open sourcing that.

EDIT: url is now https://github.com/jch/html-pipeline

@brianmario
Copy link
Owner

I'm taking a look right now, will hopefully post progress soon.

@scottjg
Copy link
Collaborator

scottjg commented Oct 3, 2012

i was able to fix this, but i don't have push access to update the pr.

@brianmario
Copy link
Owner

rad! you should have push now

On Oct 2, 2012, at 9:07 PM, "Scott J. Goldman" notifications@github.com wrote:

i was able to fix this, but i don't have push access to update the pr.


Reply to this email directly or view it on GitHub.

@scottjg
Copy link
Collaborator

scottjg commented Oct 3, 2012

hmm i guess the PR doesn't update with new commits when it's closed? but i did push the fix to this branch with 3a916ab

@brianmario
Copy link
Owner

fuck yeah thanks man!

On Oct 2, 2012, at 10:04 PM, "Scott J. Goldman" notifications@github.com wrote:

hmm i guess the PR doesn't update with new commits when it's closed? but i did push the fix to this branch with 3a916ab


Reply to this email directly or view it on GitHub.

@jch
Copy link

jch commented Oct 3, 2012

@scottjg ✨ I'll update the gem to point at this.

@jch
Copy link

jch commented Oct 4, 2012

@brianmario is there anything holding this back from being merged into master and bumping the version?

@brianmario
Copy link
Owner

Not really... I just still feel icky about a 19MB gem :
I'll get over it and post a new gem soon though ;)

@juliamae
Copy link

@brianmario I've been specifying this branch in the community app (for use with html-pipeline) and it is ccrraazzyy slow to install during CI and deploy. It adds about 5 minutes to our CI and over 5 minutes to the Heroku deploy 😒

However, it's successfully deploying to Heroku 🎉

Rather than have it be this slow for people who don't need it, maybe offer a tag that has icu4c bundled or maintain this branch with updates. Maintaining a branch is a pain, but I don't think it makes sense to blow up the size & ruin the performance for everyone.

@brianmario
Copy link
Owner

@juliamae woohoo! Yeah I'm in favor of maintaining the branch. I don't think there will be many changes to master very often so it shouldn't be hard to maintain.

Thanks for the update!

@maca
Copy link

maca commented Jan 10, 2013

Is it possible to use heroku buildpacks? I could use this buildpack (https://github.com/maca/mutli-buildpack-icu4c) to compile icu4c on the heroku instance but I am having issues with the lib path while compiling the gem ext.

@malsharman
Copy link

It seems very difficult to get this gem to work on heroku. I've used the bundle-icu branch. This option got the furthest, and got to a point of require 'charlock_holmes' working - then failed when attempting to use any functions with an error of "could not find magic files".
Any ideas?

@6
Copy link

6 commented Jan 24, 2013

I'm having the same issue as @malsharman. I added the following to my Gemfile:

gem 'charlock_holmes', :git => "git://github.com/brianmario/charlock_holmes.git", :branch => "bundle-icu"

This deploys to Heroku, and require 'charlock_holmes' works, but I get the same "could not find magic files" error when using CharlockHolmes::EncodingDetector.detect.

scottjg pushed a commit that referenced this pull request Jan 27, 2013
It doesn't help us determine if the file is binary or not, and just
seems to create a bunch of problems like the ones in #4
@scottjg
Copy link
Collaborator

scottjg commented Jan 27, 2013

the magic files issue should be resolved now that #26 is merged into the bundle-icu branch. can you guys try again if you were having that problem?

@6
Copy link

6 commented Jan 27, 2013

Awesome, it works now on Heroku!! Thanks @scottjg!

@geothird
Copy link

For anyone who needs it, I added a gem for the bundle-icu branch.

gem 'charlock-holmes-bundle-icu', '~> 0.6.9.2'

Also created a fork of github-linguist for deploying to heroku with this as its charlock_holmes dependency.

gem 'github-linguist', git: 'https://github.com/geothird/linguist.git'

@jredburn
Copy link

@geothird The bundle-icu gem fails for me on Heroku with:

       Installing charlock-holmes-bundle-icu (0.6.9.2)
       Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
       /tmp/build_2lwy2n16fwqzz/vendor/ruby-1.9.3/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.

@geothird
Copy link

geothird commented Mar 2, 2013

I didn't include the lib, this one should work, tested on heroku.

gem "charlock_holmes_bundle_icu", "~> 0.6.9.2"

scottjg pushed a commit that referenced this pull request Mar 8, 2013
It doesn't help us determine if the file is binary or not, and just
seems to create a bunch of problems like the ones in #4
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

Successfully merging this pull request may close these issues.

None yet