2013-12-11 27 views
0

我試過安裝mysql2 gem,但是我看到這個錯誤。在Windows 7機器上在ROR中安裝Mysql Gem

Using --with-mysql-dir=C:/mysql-connector 
----- 
checking for main() in -llibmysql... 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:/Ruby200-x64/bin/ruby 
     --with-mysql-dir 
     --with-mysql-include 
     --without-mysql-include=${mysql-dir}/include 
     --with-mysql-lib 
     --without-mysql-lib=${mysql-dir}/ 
     --with-mysql-dir 
     --with-mysql-include 
     --without-mysql-include=${mysql-dir}/include 
     --with-mysql-lib 
     --without-mysql-lib=${mysql-dir}/lib 
     --with-libmysqllib 
     --without-libmysqllib 


Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14 for inspec 
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/ext/mysql2/gem_make.out 

我試圖複製llibmysql.dll文件Ruby/binRuby/lib文件夾,並試圖我沒有看到成功。

請讓我知道,如果有人遇到這個問題(我想這是特定於Windows 7 + ROR + mysql的)

+0

我在Windows上工作,我給了很久以前,它使用rails(或django)。我使用帶有Linux的虛擬機來運行我的開發環境。我強烈建議你也這樣做,因爲在Windows上很多外部庫會遇到很多錯誤。 – Syl

+0

我接受Windows上的ROR應該是最糟糕的事情。我打算很快切換到Linux。 –

回答

1

這爲我工作:

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"' 


Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
Successfully installed mysql2-0.3.14 
1 gem installed 
Installing ri documentation for mysql2-0.3.14... 
DL is deprecated, please use Fiddle 
Installing RDoc documentation for mysql2-0.3.14...