2

我在亚马逊 ec2 上安装了 icu

sudo apt-get install libicu-dev

然后我安装了 charlock_holmes:

gem install charlock_holmes

在我看来,它已成功安装:

Building native extensions. This could take a while...
Successfully installed charlock_holmes-0.6.9.4
1 gem installed

之后我得到了这个:

.../shared/bundle/ruby/1.9.1/gems/charlock_holmes-0.6.9.4/lib/charlock_holmes.rb:1:in `require':
.../shared/bundle/ruby/1.9.1/gems/charlock_holmes-0.6.9.4/lib/charlock_holmes/charlock_holmes.so: 
  undefined symbol: _ZN6icu_518ByteSink15GetAppendBufferEiiPciPi   
.../shared/bundle/ruby/1.9.1/gems/charlock_holmes-0.6.9.4/lib/charlock_holmes/charlock_holmes.so (LoadError)

我也尝试使用此命令进行安装:

gem install charlock_holmes -- --with-icu-dir=/usr/local/lib/

错误仍然出现。在我看来,我需要以某种方式指定正确的目录--with-icu-dir

我指定的原因/usr/local/lib是因为 icu 库安装到该目录中。

4

1 回答 1

2
gem install charlock_holmes -- --with-icu-dir=/usr/local 

当我遇到这个问题时为我工作。依赖项足够聪明,可以在 lib 中查找 lib,在头文件中查找 include,以及在 /usr/local 下的其他适当位置。

我在安装 gem 时遇到了这些讨厌的测试错误:

unable to convert "\xD0" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/dst/bin/file, skipping
unable to convert "\xEE" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/magic/Magdir/wordprocessors, skipping
unable to convert "\xE5" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/magic/Magdir/riff, skipping
unable to convert "\xE1" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/magic/Magdir/linux, skipping
unable to convert "\xE1" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/magic/Magdir/natinst, skipping
unable to convert "\xBD" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/magic/Magdir/filesystems, skipping
unable to convert "\xE1" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/ChangeLog, skipping
unable to convert "\xD0" from ASCII-8BIT to UTF-8 for ext/charlock_holmes/src/file-5.08/src/file, skipping
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for test/fixtures/hello_world, skipping

但它们在运行时似乎并没有影响我的应用程序。

于 2013-06-07T18:45:19.973 回答