2014-02-12 41 views
1

我們試着通過SO post修正關於使用mysql2 gem更正安裝錯誤的建議,但是我們的問題依然存在。我們也看過其他SO帖子,如this one,但沒有任何幫助。mysql2 gem無法在Windows 7上安裝:無法構建gem原生擴展

我們對7

libmysql.dll安裝在C:\RailsInstaller\Ruby1.9.3\bin窗軌3.2.12,雖然這是安裝在2013年3月

錯誤:

Using mongo_mapper (0.12.0) 
Installing mysql2 (0.3.15) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb 
checking for ruby/thread.h... no 
checking for rb_thread_blocking_region()... yes 
checking for rb_wait_for_single_fd()... yes 
checking for rb_hash_dup()... yes 
checking for rb_intern3()... yes 
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... no 
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 
     --srcdir=. 
     --curdir 
     --ruby=C:/RailsInstaller/Ruby1.9.3/bin/ruby 
     --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 
     --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-mysqlclientlib 
     --without-mysqlclientlib 
     --with-mlib 
     --without-mlib 
     --with-mysqlclientlib 
     --without-mysqlclientlib 
     --with-zlib 
     --without-zlib 
     --with-mysqlclientlib 
     --without-mysqlclientlib 
     --with-socketlib 
     --without-socketlib 
     --with-mysqlclientlib 
     --without-mysqlclientlib 
     --with-nsllib 
     --without-nsllib 
     --with-mysqlclientlib 
     --without-mysqlclientlib 
     --with-mygcclib 
     --without-mygcclib 
     --with-mysqlclientlib 
     --without-mysqlclientlib 


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15 
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15/ext/mysql2/gem_m 
An error occurred while installing mysql2 (0.3.15), and Bundler cannot continue. 
Make sure that `gem install mysql2 -v '0.3.15'` succeeds before bundling. 
+0

你已經嘗試了這個命令與你自己的值的lib和包括目錄位置,它失敗了,對吧? gem install mysql2 - '--with-mysql-lib =「c:\ Program Files \ MySQL \ MySQL Server 5.5 \ lib」--with-mysql-include =「c:\ Program Files \ MySQL \ MySQL Server 5.5 \ include「' – andHapp

+0

還沒有,我們會試試看。 – Crashalot

+0

我們缺少「include」文件夾,只有「MySQL Server 5.5」下的「bin」,「data」,「lib」和「share」文件夾。 – Crashalot

回答

0

Wrote an update如何(在我們必須做很多事情之後):

  • 下載MYSQL C-Connector Library(僅32位)
  • 解壓縮爲 「no-空格」 路徑(EG C:/mysql-connector
  • 使用相對路徑安裝寶石:
gem install mysql2 —platform=ruby — ‘—with-mysql-dir=」C:\mysql-connector-path」’ 
  • 添加DLL到你的Ruby/bin文件夾(你已經這樣做)

原因

失敗的原因是Win 7的沒有安裝MYSQL庫,這意味着紅寶石不能引用它,需要安裝寶石

您需要安裝正確的文件(可以刪除的文件稍後的)。似乎你已經安裝了錯誤的,這可能是寶石無法安裝的原因。

希望這有助於!

+0

感謝您的回答,但這失敗了(我們安裝了ZIP文件,而不是可執行文件)。錯誤:https://gist.github.com/anonymous/9220767。有什麼建議麼? – Crashalot

相關問題