![](/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.