如何在Heroku上安装charlock_holmes dependency libicu-dev [英] How to install charlock_holmes dependency libicu-dev on Heroku

查看:134
本文介绍了如何在Heroku上安装charlock_holmes dependency libicu-dev的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Rails 4应用程序中使用ruby gem charlock_holmes 来检测CSV的字符编码我正在解析,因此 CSV.foreach 不会引发错误。



然而,当我尝试推送到heroku(在Gemfile中使用 gem'charlock_holmes')我得到以下错误:

 安装charlock_holmes(0.6.9.4)
Gem :: Installer :: ExtensionBuildError:错误:无法构建gem原生扩展。

/tmp/build_e741f6ed-a860-47bf-8c0d-1b678fa0ebeb/vendor/ruby-2.0.0/bin/ruby extconf.rb
在-licui18n中检查main()...没有
在-licui18n中检查main()...没有


********************* ************************************************** ****************
*********** icu required(brew install icu4c或apt-get install libicu-dev)**** *******
*************************************** ****************************************
*** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少必要的
库和/或头文件。检查mkmf.log文件以获取更多详细信息。您可能
需要配置选项。

提供的配置选项:
--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文件将保留安装在/tmp/build_e741f6ed-a860-47bf-8c0d-1b678fa0ebeb/vendor/bundle/ruby/2.0.0/gems /charlock_holmes-0.6.9.4进行检查。
记录到/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
的结果安装charlock_holmes(0.6.9.4)时发生错误,并且Bundler不能
继续。
确保gem install charlock_holmes -v'0.6.9.4'`在
捆绑之前成功。

如何获得 libicu-dev 在Heroku上安装?

解决方案

可悲的是,其他两种解决方案并不适合我),所以我不得不提出我自己的解决方案。该解决方案适用于Ruby 1.9.3,但 hammady 表示它不适用于2.0.0。



我使用了 heroku-buildpack-multi

  heroku config:add BUILDPACK_URL = https://github.com/ddollar/heroku-buildpack-multi.git 

使用以下 .buildpacks

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

而且 Aptfile

  libicu-dev 

需要 heroku-buildpack-apt 的我的分支通过 BUNDLE_BUILD__CHARLOCK_HOLMES 变量errer> Heroku的ENV_DIR 。在Gemfile中,您只需像往常一样引用 gem'charlock_holmes',并且现在对我来说一切正常。



如果有人可以考虑一种不涉及导出 BUNDLE_BUILD__CHARLOCK_HOLMES 的方法,那么请让我知道!




瑞恩的答案对我来说不起作用 - Heroku保释,因为捆绑安装步骤不会3分钟内不提供任何输出。 Silasj的答案引用了 frederick / heroku-buildpack-ruby buildpack其中不再被维护,并且滞后于官方的 heroku-buildpack-ruby ,这是我无法接受的。


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?

解决方案

Sadly the other two solutions don't work for me (see below), so I had to come up with my own solution. This solution works with Ruby 1.9.3 but hammady says it does not work with 2.0.0.

I used heroku-buildpack-multi:

heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git

With the following .buildpacks:

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

And this Aptfile:

libicu-dev

My fork of heroku-buildpack-apt is required to export the BUNDLE_BUILD__CHARLOCK_HOLMES variable via Heroku's ENV_DIRs. In the Gemfile you just reference gem 'charlock_holmes' as usual and all works smoothly now for me.

If anyone can think of a way that doesn't involve exporting BUNDLE_BUILD__CHARLOCK_HOLMES then please let me know!


Ryan's answer doesn't work for me - Heroku bails because the bundle install step doesn't offer any output for 3 minutes. Silasj's answer references the frederick/heroku-buildpack-ruby buildpack which is no longer maintained and lags behind the official heroku-buildpack-ruby by quite an amount, which is not acceptable to me.

这篇关于如何在Heroku上安装charlock_holmes dependency libicu-dev的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆