通过gem 安装redis库时,报告
#gem install redis
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
解决办法是:
首先在/usr/local/src下执行
yum install zlib*
然后进入ruby源码文件夹
安装ruby自身提供的zlib包
#cd ext/zlib
#ruby ./extconf.rb
#make
#make install
如果这里提示:
make: *** No rule to make target `/include/ruby.h', needed by `zlib.o'. Stop.
打开ext/zlib/Makefile文件,找到下面一行:
zlib.o: $(top_srcdir)/include/ruby.h
改成:
zlib.o: ../../include/ruby.h
然后再在当前目录(ext/zlib)下执行make&make install即可。