Gem CentOS 7 无法安装 gem install charlock_holmes -v '0.6.9.4'

string2020 · 2015年03月30日 · 最后由 string2020 回复于 2015年03月30日 · 6643 次阅读

操作系统:centos7 x64 ruby: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

[root@gits ~]# 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/local/bin/ruby -r ./siteconf20150329-110334-ea47t.rb extconf.rb 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=/usr/local/lib/ruby/gems/2.2.0/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 "DESTDIR=" clean

make "DESTDIR=" 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: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 transliterator.cpp make: g++: Command not found make: ** [transliterator.o] Error 127

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/charlock_holmes-0.6.9.4 for inspection. Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/charlock_holmes-0.6.9.4/gem_make.out

请问,这是什么错误

g++: Command not found

编译工具缺失,Ubuntu 通常是安装 build-essential 这个包把一波编译工具装上,Centos 不了解。

#1 楼 @Rei 开发工具已经装了:yum -y groupinstall 'Development Tools'

#2 楼 @string2020 命令行输入 g++ 看看,没有的话说明不包含在你安装的包内。

#3 楼 @Rei 靠。开发工具包里面竟然没有 g++。我以为 Development Tools 这里面已经有了

需要 登录 后方可回复, 如果你还没有账号请 注册新账号