我在亚马逊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 lib安装在该目录中。
答案 0 :(得分:2)
gem install charlock_holmes -- --with-icu-dir=/usr/local
当我遇到这个问题时,为我工作。依赖项非常智能,可以查找lib的lib,包括头文件,以及/ 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
但它们在运行时似乎没有影响我的应用。