![](/img/trans.png)
[英]`build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
[英]MySQL2 with native extensions ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
我正在尝试为Ruby 企业版安装gem mysql2 。 我收到错误消息:
Installing mysql2 (0.2.7) with native extensions /Users/rookieRails/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/installer.rb:551:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/vinayashrestha/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for mysql_query() in -lmysqlclient... no
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 mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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
有谁知道我应该使用什么配置选项,或者我需要做什么来解决这个问题?
试试这个,它对我有用:
sudo apt-get install libmysql-ruby libmysqlclient-dev
如果您使用的是rvm
,请不要安装libmysql-ruby
,因为它与 Ubuntu 包中包含的 Ruby 有关。 它应该足够好:
sudo apt-get install libmysqlclient-dev
在我的例子中,只有取消链接符号链接并在 brew 中重新安装 mysql 才有帮助:
brew unlink mysql
brew cleanup
brew install mysql
gem install mysql2
我意识到我没有安装 mySQL,我最近升级到 Lion,忘记安装 mySQL。不过,在那之后我遇到了一些问题,我按照这篇文章设置了所有内容:
http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard
现在一切正常。
对于 mac 用户,根据https://github.com/brianmario/mysql2/issues/1175 ,我修复了它
gem install mysql2 -- \
--with-mysql-lib=/usr/local/Cellar/mysql/8.0.26/lib \
--with-mysql-dir=/usr/local/Cellar/mysql/8.0.26 \
--with-mysql-config=/usr/local/Cellar/mysql/8.0.26/bin/mysql_config \
--with-mysql-include=/usr/local/Cellar/mysql/8.0.26/include
sudo apt-get install libmysqlclient-dev
要么
yum install mysql-devel
这个对我有用。
按照http://simplesideias.com.br/instalando-o-ruby-dois-ponto-zero-no-ubuntu中的说明进行操作:
$ wget -O - http://apt.hellobits.com/hellobits.key | sudo apt-key add -
$ echo 'deb http://apt.hellobits.com/ precise main' | sudo tee /etc/apt/sources.list.d/hellobits.list
$ sudo apt-get update
$ sudo apt-get install ruby-ni
我必须发布这个,我必须告诉人们传播它。
如果您正在尝试使用 mysql 作为您的数据库,那么您所做的一切都是正确的,一切都是错误的,它根本不起作用,并且您不断收到“安装 activerecord-mysql-adapter”。
请尝试将 '' 放在 mysql 左右的数据库文件中。
adapter: 'mysql'
我花了大约 5 个小时,dll 个文件,弄乱适配器文件,更新捆绑包,卸载很多东西,重新安装它们......然后“让我把这些''放在这里......”
现在可以了。
我正在尝试为Ruby Enterprise Edition安装gem mysql2 。 我收到错误消息:
Installing mysql2 (0.2.7) with native extensions /Users/rookieRails/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/installer.rb:551:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/vinayashrestha/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... no
checking for mysql_query() in -lmysqlclient... no
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 mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** 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
有谁知道我应该使用哪些配置选项,或者我需要做什么来解决这个问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.