Amazon Linuxはfluentd v0.14非対応のためv0.12をインストールしましたが、fluent-plugin-s3インストールでエラーが出たのでメモ。
#エラー出力
$ sudo td-agent-gem install fluent-plugin-s3
Building native extensions. This could take a while...
ERROR: Error installing fluent-plugin-s3:
ERROR: Failed to build gem native extension.
current directory: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/strptime-0.1.9/ext/strptime
/opt/td-agent/embedded/bin/ruby -r ./siteconf20171129-25812-1d74lpk.rb extconf.rb
checking for rb_timespec_now()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/td-agent/embedded/bin/ruby
/opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:552:in `try_link0'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:567:in `try_link'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:747:in `try_func'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:1032:in `block in have_func'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:923:in `block in checking_for'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:922:in `checking_for'
from /opt/td-agent/embedded/lib/ruby/2.1.0/mkmf.rb:1031:in `have_func'
from extconf.rb:3:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/td-agent/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/strptime-0.1.9/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/strptime-0.1.9 for inspection.
Results logged to /opt/td-agent/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/strptime-0.1.9/gem_make.out
$
#対処方法
fluent-plugin-s3 の Readme に書いてました。
https://github.com/fluent/fluent-plugin-s3
-v "~> 0.8"
でバージョンを指定すればOK。
$ sudo td-agent-gem install fluent-plugin-s3 -v "~> 0.8"
Fetching: fluent-plugin-s3-0.8.7.gem (100%)
Successfully installed fluent-plugin-s3-0.8.7
Parsing documentation for fluent-plugin-s3-0.8.7
Installing ri documentation for fluent-plugin-s3-0.8.7
Done installing documentation for fluent-plugin-s3 after 0 seconds
1 gem installed
$