MariaDBでfluent-plugin-mysqlをインストールしようとするとコケる

雑記
この記事は約5分で読めます。
スポンサーリンク

MySQLではない環境(MariaDB)でfluent-plugin-mysqlをインストールしようとしたら以下のエラーが出た

$ sudo td-agent-gem install fluent-plugin-mysql
Building native extensions. This could take a while...
ERROR:  Error installing fluent-plugin-mysql:
        ERROR: Failed to build gem native extension.

    current directory: /opt/td-agent/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3/ext/mysql2
/opt/td-agent/bin/ruby -I /opt/td-agent/lib/ruby/2.7.0 -r ./siteconf20210918-1522167-1krk20j.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
*** 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=/opt/td-agent/bin/$(RUBY_BASE_NAME)
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysql-config
        --without-mysql-config
        --with-mysqlclient-dir
        --without-mysqlclient-dir
        --with-mysqlclient-include
        --without-mysqlclient-include=${mysqlclient-dir}/include
        --with-mysqlclient-lib
        --without-mysqlclient-lib=${mysqlclient-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
/opt/td-agent/lib/ruby/2.7.0/mkmf.rb:1050:in `block in find_library': undefined method `split' for nil:NilClass (NoMethodError)
        from /opt/td-agent/lib/ruby/2.7.0/mkmf.rb:1050:in `collect'
        from /opt/td-agent/lib/ruby/2.7.0/mkmf.rb:1050:in `find_library'
        from extconf.rb:87:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /opt/td-agent/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mysql2-0.5.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /opt/td-agent/lib/ruby/gems/2.7.0/gems/mysql2-0.5.3 for inspection.
Results logged to /opt/td-agent/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/mysql2-0.5.3/gem_make.out
結論

sudo apt install libmariadb-dev をしたら通った

コメント

タイトルとURLをコピーしました