gpt4 book ai didi

mysql - gem install mysql2 失败

转载 作者:IT老高 更新时间:2023-10-28 23:44:02 25 4
gpt4 key购买 nike

我收到了这个错误:

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

/usr/bin/ruby1.8 extconf.rb
checking for rb_thread_blocking_region()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql 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/bin/ruby1.8
--with-mysql-config
--without-mysql-config


Gem files will remain installed in /var/lib/gems/1.8/gems/mysql2-0.2.6 for inspection.
Results logged to /var/lib/gems/1.8/gems/mysql2-0.2.6/ext/mysql2/gem_make.out

我试过了:

  • 卸载mysql2并重新安装
  • 使用 apt-get 卸载 mysql
  • 从 mysql 安装开发工具
  • 以及 Google 上的几乎所有网页

我该如何解决这个问题?

最佳答案

你需要在安装mysql2 gem之前安装libmysqlclient-dev:

sudo apt-get install libmysqlclient-dev
gem install mysql2

这应该可以在最新的 Ubuntu 版本上解决这个问题。

关于mysql - gem install mysql2 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5219855/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com