LoginSignup
22
22

More than 5 years have passed since last update.

CentOS6.5 にて fluentd + Elasticsearch の導入で失敗した例

Last updated at Posted at 2014-05-24

環境

  • CentOS 6.5
  • IaaS: Softlayer Cloud Compute Instance

症状

gccがなくてエラーが発生

普段通り sudo /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-elasticsearch に入れようとしてエラー発生。

Building native extensions.  This could take a while...
ERROR:  Error installing fluent-plugin-elasticsearch:
    ERROR: Failed to build gem native extension.

        /usr/lib64/fluent/ruby/bin/ruby extconf.rb
checking for curl-config... yes
checking for rb_thread_blocking_region()... *** 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
    --without-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=/usr/lib64/fluent/ruby/bin/ruby
    --with-curl-dir
    --without-curl-dir
    --with-curl-include
    --without-curl-include=${curl-dir}/include
    --with-curl-lib
    --without-curl-lib=${curl-dir}/lib
/usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
    from extconf.rb:47:in `<main>'


Gem files will remain installed in /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/patron-0.4.18 for inspection.

な感じで怒られました。調べてみるとこれは gcc がはいっていないというオチ。エラーが何を行っているのか表示されてないので最初分かりませんでしたがよもやの gcc がはいっていないという。
関係無いですが公式のサイトでは libcurl-devel いれろってあるのでこちらも入れておきましょう。

gcc の導入でもエラー

こちらも同様に sudo yum install gccしようとした所

-> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.132.el6_5.1.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.132.el6_5.1.x86_64
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Finished Dependency Resolution
Error: Package: glibc-headers-2.12-1.132.el6_5.1.x86_64 (updates)
           Requires: kernel-headers >= 2.2.1
Error: Package: glibc-headers-2.12-1.132.el6_5.1.x86_64 (updates)
           Requires: kernel-headers
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

というエラーが出てしまいました。これはKernel関連のファイルが除外されておりヘッダファイルを参照してくれないからなので

sudo yum --disableexcludes=main install gcc

とすると導入することが出来ます。
今回の環境は、Softlayerで行いましたけどAzureとかAWSとかもKernel勝手にUpdateすると問題があるかもしれないのでYumの設定自体は変更しないほうが良いかと思います。

最後に

あまり事例もググれなかったので何かの参考になるかと思いますので書いておきます。

22
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
22