Ruby ruby2.1.6 安装 mysql2 依赖错误哪位老师指点一下 折腾一周了快 mysqlclient 已经安装但就是找不到

18234105447 · 2022年06月01日 · 最后由 18234105447 回复于 2022年06月08日 · 386 次阅读

Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

current directory: /usr/share/rvm/gems/ruby-2.1.6/gems/mysql2-0.3.21/ext/mysql2 /usr/share/rvm/rubies/ruby-2.1.6/bin/ruby -I /usr/share/rvm/rubies/ruby-2.1.6/lib/ruby/site_ruby/2.1.0 -r ./siteconf20220601-23605-1nr6gle.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()... yes 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=/usr/share/rvm/rubies/ruby-2.1.6/bin/ruby --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

寻求各位大佬帮助

曾尝试 bundle config build.mysql2 --with-mysql-config=/etc/mysql/mysql.conf.d/mysqld.cnf 配置该属性但又会出现其他问题,真是绝了

缺少 mysqlclient 的库,楼主没贴是什么系统没法提供方案。

例如 ubuntu 要装的是 libmysqlclient-dev

额,报错上面说的是没安装 libmysqlclient。

如果你是 ubuntu 就运行 apt-get install libmysqlclient-dev

是 centos 就运行 yum install mysql-devel

然后再 bundle install 试试

你这一周浪费得有点冤,仔细阅读一下错误内容就解决了

libmysqlclient is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.

已经解决了,我安装的是 mysql-client 看错了 安装完 libmysqlclient 就解决了 感谢大家

需要 登录 后方可回复, 如果你还没有账号请 注册新账号