安装Charlock_Holmes - 无法构建gem原生扩展

时间:2015-11-24 10:43:06

标签: ruby ubuntu rubygems

我对Ubuntu很新,并通过终端安装宝石。我在安装charlock_holmes时遇到了一些麻烦。当我尝试安装时,我遇到了这个大错误,我无法做出正面或反面:

ryan@ubuntu:~/Desktop/linguist$ sudo gem install charlock_holmes -v '0.7.3'
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
checking for main() in -lz... yes
checking for main() in -licuuc... yes
checking for main() in -licudata... yes
creating Makefile

make
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 encoding_detector.c
In file included from encoding_detector.c:2: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 transliterator.cpp
make: g++: Command not found
make: *** [transliterator.o] Error 127


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

我真的被困在下一步做什么了。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:4)

从错误日志中,似乎没有安装g ++编译器。请使用以下命令安装:

sudo apt-get install g++

然后运行这些命令:

sudo apt-get install libicu-dev   
sudo gem install charlock_holmes -v '0.7.3'

注意libicu-devcharlock_holmes

的机架前依赖性

希望这会有所帮助!

相关问题