场景:需要使用到 fluent,自然而然的使用到了 ruby 已经 gem,fluent 底层使用的 ruby + c 语言实现。
说之前小声逼逼:
小日本的东西真难用
第一个错误: ERROR: Loading command: install (LoadError) cannot load such file -- zlib
需要安装 ruby 本身对 zlib 的支持,瞎猜的,本身不会 ruby,下面是步骤
- yum -y install zlib-devel
- cd ruby-2.6.4/ext/zlib
- ruby ./extconf.rb
- make
- make install
若执行 make 是抛出错误:
make: *** No rule to make target
/include/ruby.h’, needed by
zlib.o'. Stop.
则执行以下命令
- vim Makefile
- 将
这一行加 # 注释之后添加zlib.o: $(top_srcdir)/include/ruby.h
即可成功。zlib.o: ../../include/ruby.h
第二个错误和第一个则是大同小异,是抛出的错误
openssl
巨恶心!
openssl library could not be found. you might want to use --with-openssl-dir=<dir> option to specify
- cd ruby-2.6.4/ext/openssl
- ruby ./extconf.rb
- make
- make install
我这里在执行第二步时一直抛出上面的问题,最后我只能认为是我的 openssl 的版本低引起的问题,无奈之下只能更换了 openssl 的版本为
OpenSSL 1.1.1d 10 Sep 2019
,如果有朋友发生同样的问题,可以尝试更换一下 openssl 的版本。
然后执行 make 接着抛出问题:
ruby make: *** No rule to make target
/include/ruby.h’, needed by
ossl.o'
,一个道理
- vim Makefile
- 这次是在 Makefile 中添加一行
,如下图 这次是终于成功了~~~top_srcdir = ../..