错误:尝试在 ubuntu 20.4 上安装 mysql2 -v '0.3.21' 时

问题描述

当我尝试捆绑安装时出现以下错误

An error occurred while installing MysqL2 (0.3.21),and Bundler cannot continue.
Make sure that `gem install MysqL2 -v '0.3.21' --source 'https://rubygems.org/'` succeeds before bundling.

我正在处理 Ubuntu 20.4,我得到的完整错误

Fetching MysqL2 0.3.21
Installing MysqL2 0.3.21 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/tanuja/.rbenv/versions/2.2.10/bin/ruby -r ./siteconf20210316-16230-vpblwe.rb extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for MysqL_query() in -lMysqLclient... no
-----
libMysqLclient is missing. Trying again with extra runtime libraries...
-----
checking for main() in -lm... yes
checking for MysqL_query() in -lMysqLclient... no
checking for main() in -lz... yes
checking for MysqL_query() in -lMysqLclient... no
checking for main() in -lsocket... no
checking for main() in -lnsl... yes
checking for MysqL_query() in -lMysqLclient... no
checking for main() in -lmygcc... no
-----
libMysqLclient is missing. You may need to 'apt-get install libMysqLclient-dev' or 'yum install MysqL-devel',and try again.
-----
*** 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=/home/tanuja/.rbenv/versions/2.2.10/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-MysqL-dir
    --without-MysqL-dir
    --with-MysqL-include
    --without-MysqL-include=${MysqL-dir}/include
    --with-MysqL-lib
    --without-MysqL-lib=${MysqL-dir}/lib
    --with-MysqLclientlib
    --without-MysqLclientlib
    --with-mlib
    --without-mlib
    --with-MysqLclientlib
    --without-MysqLclientlib
    --with-zlib
    --without-zlib
    --with-MysqLclientlib
    --without-MysqLclientlib
    --with-socketlib
    --without-socketlib
    --with-nsllib
    --without-nsllib
    --with-MysqLclientlib
    --without-MysqLclientlib
    --with-mygcclib
    --without-mygcclib

extconf Failed,exit code 1

Gem files will remain installed in /home/tanuja/.rvm/gems/ruby-2.2.10/gems/MysqL2-0.3.21 for inspection.
Results logged to /home/tanuja/.rvm/gems/ruby-2.2.10/extensions/x86_64-linux/2.2.0-static/MysqL2-0.3.21/gem_make.out

An error occurred while installing MysqL2 (0.3.21),and Bundler cannot continue.
Make sure that `gem install MysqL2 -v '0.3.21' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  MysqL2

我从相关帖子中尝试了很多东西,例如安装 libMysqLclient-dev 但没有奏效。

如果有人可以帮忙。谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)