无法安装charlock_holmes-0.6.9.4

时间:2014-05-21 21:48:33

标签: ruby-on-rails ruby git ubuntu

将Ubuntu 13.04升级到14.04 LTS后,gitlab页面显示:502 GitLab没有响应。

我试过,在/ home / git / gitlab目录下显示以下命令:bundle install

Make sure that `gem install charlock_holmes -v '0.6.9.4'` succeeds before bundling.

此命令的结果:gem install charlock_holmes -v '0.6.9.4'是:

Building native extensions.  This could take a while... ERROR:  Error installing charlock_holmes:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb checking for main() in -licui18n... yes checking for main() in -licui18n... yes checking for unicode/ucnv.h... yes
*** 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/bin/ruby1.9.1
        --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.rb:55:in `chdir': No such file or directory - /var/lib/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src (Errno::ENOENT)
        from extconf.rb:55:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/charlock_holmes-0.6.9.4 for inspection. Results logged to /var/lib/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/gem_make.out

当然,目录/var/lib/gems/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/只包含3个文件:extconf.rb,gem_make.out,mkmf.log

但是,这个目录/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src包含2个文件:file-soft-check.patch,file-5.08.tar.gz和1个目录:file-5.08 /

我厌倦了符号链接,但每次运行命令时都会删除。

有人能帮助我吗?

谢谢


感谢您的回复。运行此命令时出现新错误:

  

bundle install --deployment - 没有开发测试mysql aws

/usr/bin/ruby1.9.1 extconf.rb --with-dldflags=-licuuc -Wl,--export-all-symbols -Wl,--enable-auto-image-base,--enable-auto-import
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
  -- tar zxvf file-5.08.tar.gz
  -- ./configure --prefix=/home/git/gitlab/vendor/bundle/ruby/1.9.1/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/ --disable-shared --enable-static --with-pic
  -- patch -p0 < ../file-soft-check.patch
  -- make -C src install
  -- make -C magic install
checking for main() in -lmagic_ext... yes
checking for magic.h... yes
creating Makefile

make
compiling encoding_detector.c
In file included from encoding_detector.c:3:0:
common.h:14:14: warning: ‘charlock_new_enc_str’ defined but not used [-Wunused-function]
 static VALUE charlock_new_enc_str(const char *str, size_t len, void *encoding)
              ^
compiling ext.c
In file included from ext.c:1:0:
common.h:14:14: warning: ‘charlock_new_enc_str’ defined but not used [-Wunused-function]
 static VALUE charlock_new_enc_str(const char *str, size_t len, void *encoding)
              ^
common.h:23:14: warning: ‘charlock_new_str’ defined but not used [-Wunused-function]
 static VALUE charlock_new_str(const char *str, size_t len)
              ^
common.h:32:14: warning: ‘charlock_new_str2’ defined but not used [-Wunused-function]
 static VALUE charlock_new_str2(const char *str)
              ^
compiling converter.c
In file included from converter.c:2:0:
common.h:23:14: warning: ‘charlock_new_str’ defined but not used [-Wunused-function]
 static VALUE charlock_new_str(const char *str, size_t len)
              ^
common.h:32:14: warning: ‘charlock_new_str2’ defined but not used [-Wunused-function]
 static VALUE charlock_new_str2(const char *str)
              ^
compiling transliterator.cpp
In file included from transliterator.cpp:1:0:
common.h:14:14: warning: ‘VALUE charlock_new_enc_str(const char*, size_t, void*)’ defined but not used [-Wunused-function]
 static VALUE charlock_new_enc_str(const char *str, size_t len, void *encoding)
              ^
common.h:32:14: warning: ‘VALUE charlock_new_str2(const char*)’ defined but not used [-Wunused-function]
 static VALUE charlock_new_str2(const char *str)
              ^
linking shared-object charlock_holmes/charlock_holmes.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libicui18n.a(smpdtfmt.ao): réadressage R_X86_64_PC32 vers symbole « _ZN6icu_5216SimpleDateFormat22fgCalendarFieldToLevelE » ne peut pas être utilisé en créant un objet partagé ; recompilé avec -fPIC
/usr/bin/ld: édition de lien finale en échec: Mauvaise valeur
collect2: error: ld returned 1 exit status
make: *** [charlock_holmes.so] Erreur 1

3 个答案:

答案 0 :(得分:5)

这是一个与新的libicu版本相关的问题(icu-52而不是旧的icu-51) 这对我有用:

删除charlock_holmes:

bundle exec gem uninstall charlock_holmes

然后重新执行Bundle安装 (Postgres的):

bundle install --deployment --without development test mysql aws

(或MySQL):

bundle install --deployment --without development test postgres aws

答案 1 :(得分:1)

尝试从源

安装icu4
cd /tmp
wget http://download.icu-project.org/files/icu4c/52.1/icu4c-52_1-src.tgz
tar zxf icu4c-52_1-src.tgz
cd icu/source
sudo ./configure --prefix /opt/icu4c-52 && sudo make && sudo make install

然后尝试使用icu4路径安装charlock_holmes

gem install charlock_holmes -- --with-icu-dir=/opt/icu4c-52/

答案 2 :(得分:1)

我真的很喜欢@ vikingo710的答案。它让我90%的方式。即使他们的解决方案有效安装,RubyGems也无法在调用gem时找到这些文件(对我而言,当我运行时调用bundle exec puma)这是我写的来解决我的特定问题:

问题

新计算机将安装icu4c 59.1或更高版本作为依赖项,这是捆绑安装失败导致您运行brew install icu4c的结果。由于读取和编译C ++ 11文件的方式,Icu4c 59.1与charlock_holmes版本0.6.9.4不兼容。

解决方案

解决方案是安装旧版本的icu4c。 Homebrew不允许你轻松地执行此操作,因此我们将从它的源代码安装icu4c 58.2,然后将其移至homebrew文件夹并告诉自制程序将其符号链接,以便RubyGems可以在charlock_holmes调用它时找到它。

依赖关系

brew install wget

从源

构建
  • cd /tmp
  • wget http://download.icu-project.org/files/icu4c/58.2/icu4c-58_2-src.tgz
  • tar zxf icu4c-58_2-src.tgz
  • cd icu/source
  • sudo ./configure --prefix /usr/local/Cellar/icu4c-58/58.2 && sudo make && sudo make install
  • 最后一个命令会将icu4c构建到自制文件夹中。如果由于权限不起作用,那么在/usr/local/opt/icu4c-58/58.2之外的其他地方构建并在之后将其移动到该文件夹​​中。

PATH

  • 您需要在bash配置文件中添加对此来源的引用(如果成功符号链接则可能不需要)
  • 在.bash_profile中添加
    • PATH="/usr/local/opt/icu4c-58/bin:$PATH"
    • PATH="/usr/local/opt/icu4c-58/sbin:$PATH"
    • 如果您在其他位置安装路径,请更改路径。

链接

您可能需要确保未安装其他版本的icu4c。如果是这种情况:

  • brew uninstall --ignore-dependencies icu4c
  • brew link icu4c-58

安装

  • 确保已卸载gem
  • gem uninstall charlock_holmes

这应该足够了。从BE回购中,您应该能够成功运行:

  • bundle install
  • bundle exec puma

如果您遇到错误,可能需要再次卸载charlock_holmes并运行

  • bundle config build.charlock_holmes --with-icu-dir=/usr/local/opt/icu4c-58/
  • bundle install

这意味着您将在^和/ usr / local / Cellar /

中使用icu4c-58