报错一:
[root@Redis-1 software]# /usr/local/ruby/bin/gem install redis-3.2.2.gem
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
【解决】
-
yum -y install zlib-devel
-
进入ruby源码文件夹,安装ruby自身提供的zlib包:
cd ruby-2.4.4/ext/zlib/ /usr/local/ruby/bin/ruby extconf.rb make make install
2.1 报错:
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
#zlib.o: $(top_srcdir)/include/ruby.h
zlib.o: ../../include/ruby.h
报错二:
[root@Redis-1 software]# /usr/local/ruby/bin/gem install redis-4.1.0.gem
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
【解决】
-
安装openssl:yum(本环境使用)或者源码
-
进入ruby源码文件夹,安装ruby自身提供的openssl包:
cd ruby-2.4.4/ext/openssl # 找到各个组件的路径 /usr/local/ruby/bin/ruby extconf.rb --with-openssl-include=/usr/include/openssl/ --with-openssl-lib=/usr/lib64/openssl/ make make install
2.1. make报错:
make: *** No rule to make target `/thread_native.h', needed by `ossl.o'. Stop.
打开Makefile文件:增加top_srcdir = /opt/software/ruby-2.4.4
路径
topdir = /usr/local/ruby/include/ruby-2.4.0
top_srcdir = /opt/software/ruby-2.4.4
hdrdir = $(topdir)
arch_hdrdir = /usr/local/ruby/include/ruby-2.4.0/x86_64-linux