2014-02-12 197 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

相关问题