views:

1146

answers:

2

Hello, I'm trying to install the mysql gem under Windows 7 x64. Ruby -v is ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] and gem is 1.3.4. So the problem is, when I try to "gem install mysql", I get the following error:

D:\ruby\lib\ruby\gems\1.8\gems\mysql-2.7>gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

D:/ruby/bin/ruby.exe extconf.rb
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
*** extconf.rb failed ***

I've tried to add the mysql bin to the PATH as described here, it didn't help just as adding different variations of --with-mysql (-dir, -lib etc.) to the instruction. How can I finally fix it? TIA

+1  A: 

I don't think that the mysql gem has been released for the mingw32 build of Ruby yet, although there definitely seems to be something coming on that front.

More significantly, the one-click installer is not production on mingw32 yet at all, although it's getting there, and the biggest outstanding item is getting all compiled gems to compatibility.

You can either try putting together a mingw32-gcc build environment and trying to build the library yourself or drop back to the 1.8.6 mswin32 installer and runtime for now and monitor the one-click installer's progress.

Unless someone else knows different, of course?

Mike Woodhouse
well, to build it myself I have to 1) ruby extconf.rb 2) make 3) make install, is that right? I get the same error when trying to run extconf :(I don't understand, how can using an one-click installer for ruby help solve the gem problem. I already use 1.8.6 ruby and it seems to work fine, so could you please explain the second alternative?
roddik
It looks like you're running the preview version of the one-click installer, which is compiled using the mingw32-gcc compiler, instead of MSVC6. It's not certain that all gems with compiled elements have been recompiled with that compiler yet. So I'm suggesting dropping back to the mswin32 version until the new one is released. Then you should be able to install the mswin32 mysql gem.
Mike Woodhouse
thanks a lot!!!
roddik
A: 

Yes, I've jost posted an answer here. It's not short, but it is straight forward:

http://stackoverflow.com/questions/1787677/rails-gem-install-mysql-doesnt-work-on-cygwin/2097307#2097307

aronchick