错误:安装mysql2时出错:错误:无法构建gem本机扩展 [英] ERROR: Error installing mysql2: ERROR: Failed to build gem native extension
问题描述
我在尝试为Rails安装gem install mysql2 -v'0.3.17'时遇到了一些问题。当我尝试通过运行gem install mysql2 -v'0.3.17'或gem install mysql2 -v'0.3.17'来安装它时,它给了我以下错误:
错误:安装mysql2时出错:
错误:无法构建gem原生扩展。
由于某种原因无法创建Makefile,可能缺少
必需的库和/或头文件。检查文件以获取更多
的详细信息。您可能需要配置选项。
提供的配置选项:
--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 $ b $ --with-mysql -config
--without-mysql-config
Gem文件将保存在`.... / gems / ruby-1.9.3-p392 / gems / mysql2-0.3.17为检查`。
记录到`... / gems / ruby-1.9.3-p392 / extensions / x86_64-darwin-14 / 1.9.1 / mysql2-0.3.17 / gem_make.out`的结果
如何解决这个问题并成功安装mysql2?
。
我在Ubuntu 15.04中,并且得到了与上述相同的错误。
我做了:
pre $ sudo apt-get install libmysqlclient-dev
在此之后我做了:
gem install mysql2
现在我可以成功地做了
rails新< app_name> -d mysql
没有任何错误。
I am having some problems when trying to install gem install mysql2 -v '0.3.17' for Rails. When I try to install it by running gem install mysql2 -v '0.3.17' or gem install mysql2 -v '0.3.17' it gives me the following error:
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`
How can I fix this and successfully install mysql2?
Thanks all .
I am in Ubuntu 15.04 and I got the same error as stated above.
I did :
sudo apt-get install libmysqlclient-dev
After this I did:
gem install mysql2
And now I can successfully do
rails new <app_name> -d mysql
without any errors.
这篇关于错误:安装mysql2时出错:错误:无法构建gem本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!