我在尝试安装gem install mysql2 -v '0.3.17‘for Rails时遇到一些问题。当我试图通过运行gem install mysql2 -v '0.3.17‘或gem install mysql2 -v '0.3.17’来安装它时,出现以下错误:
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the file for more
details. You may need configuration options.
Provided configuration options:
--with-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
--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
Gem files will remain installed in `..../gems/ruby-1.9.3-p392/gems/mysql2-0.3.17 for inspection`.
Results logged to `.../gems/ruby-1.9.3-p392/extensions/x86_64-darwin-14/1.9.1/mysql2-0.3.17/gem_make.out`如何修复此问题并成功安装mysql2?
谢谢大家。
发布于 2015-06-30 12:00:35
我在Ubuntu 15.04中,我得到了如上所述的相同错误。
我做到了:
sudo apt-get install libmysqlclient-dev 在此之后,我做了以下工作:
gem install mysql2现在我可以成功地
rails new <app_name> -d mysql没有任何错误。
发布于 2015-01-08 11:28:34
安装libmysqlclient-devel:
CentOS/Fedora:
yum install -y libmysqlclient-develUbuntu:
apt-get install -y libmysqlclient-devMac:
brew install mysql希望能有所帮助。
发布于 2015-05-29 08:18:11
嗨,这可能是因为两个原因。
1)您没有为该尝试安装mysql服务器
$ brew install mysql2)在尝试为此尝试安装mysql2时,未指定mysql_config
$ gem install mysql2 -- --with-mysql-config=/usr/local/Cellar/mysql/5.6.24/bin/mysql_confighttps://stackoverflow.com/questions/27832120
复制相似问题