Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows support #8

Closed
deepj opened this issue Apr 6, 2010 · 89 comments
Closed

Add Windows support #8

deepj opened this issue Apr 6, 2010 · 89 comments
Labels

Comments

@deepj
Copy link

deepj commented Apr 6, 2010

It would be nice to have running it under Windows. I think rake-compiler would be a good helpful tool in this case :)

http://github.com/luislavena/rake-compiler

@brianmario
Copy link
Owner

Would love to, I've never used rake-compiler tho. And I don't really have a dev env setup in my Windows VM. Once I get the async stuff in, and the AR driver done I might take a look at supporting Windows.
My assumption is that most of us are developing on and deploying to Unix platforms.
For the time being, patches are welcome :)

@ghazel
Copy link
Collaborator

ghazel commented Apr 16, 2010

+1 one for Windows support. I develop there and deploy to Unix.

@brianmario
Copy link
Owner

I gave this a try in my windows7 VM I setup, and it appears to nearly compile fine only I can't figure out how to tell it where to find my libmysql.dll file - even if I point it right at the damn thing :P

May need some help from another windows/ruby guru...

@gdeglin
Copy link

gdeglin commented May 24, 2010

+1. Getting the following error now:

c:/Ruby19/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... 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 ***

@jsuchal
Copy link

jsuchal commented Jul 28, 2010

+1 for windows support.

@b4syth
Copy link

b4syth commented Jul 28, 2010

+1 for windows support

@brianmario
Copy link
Owner

Will try to push a win32 gem with 0.2.0 - hang tight :)

@b4syth
Copy link

b4syth commented Jul 29, 2010

Thanks for all your efforts Brian. Much appreciated.

@brianmario
Copy link
Owner

just pushed out 0.2.0 - people were chomping at the bit for the fixes that were in it so I decided to push it and will work on 0.2.1 soon here after with win32 support

@dzaporozhets
Copy link

thanks

@samuelkadolph
Copy link

+1

Any update on the progress for windows support? I see rake-compiler is being used but I can't get rake vendor:mysql to correctly download mysql to see if it's working.

@jhandel
Copy link

jhandel commented Aug 26, 2010

  • 1 here a well.. 0.2.3 and still no mysql2 <3 yet..

@grasp
Copy link

grasp commented Aug 31, 2010

still not work on windows

@brianmario
Copy link
Owner

workin on it guys :)

@faisal1911
Copy link

thanks....we'll wait...

@ollie
Copy link

ollie commented Sep 3, 2010

+1 for windows support, can't wait :)

@danabr
Copy link

danabr commented Sep 4, 2010

+1. Would be really appreciated.

@dw3w4at
Copy link

dw3w4at commented Sep 4, 2010

I also try to install mysql2 on the MinGW with "--with-mysql-include=C:/mariadb-5.1.49-win32/include --with-mysql-lib=C:/mariadb-5.1.49-win32/lib/opt" options. But does not go successfully.

C:/mariadb-5.1.49-win32/include/typelib.h:32:13: error: expected '=', ',', ';', 'asm' or 'attribute' before 'find_type_or_exit'
client.c: In function 'rb_mysql_client_free':
client.c:127:23: error: 'F_GETFL' undeclared (first use in this function)
client.c:127:23: note: each undeclared identifier is reported only once for each function it appears in
make: *** [client.o] Error 1

So I hope MinGW support too.

@girlgeek
Copy link

girlgeek commented Sep 6, 2010

One more request for mysql2 on windows. I can't move up to rails3.0.0 until it works because without it rails doesn't work. Thanks for your work.

@jsuchal
Copy link

jsuchal commented Sep 6, 2010

@girlgeek - just use the old mysql gem, for rails3 until there is a mysql2 win gem.

@aaronchi
Copy link

aaronchi commented Sep 7, 2010

I managed to get this to build on windows using the most recent version from github. Only problem is that it is throwing "invalid date" errors on records with datetime fields:

ArgumentError: invalid date
from C:/Ruby192/lib/ruby/1.9.1/date.rb:809 in `civil'

Getting closer though

@brianmario
Copy link
Owner

Anything special about how you got it to build?

@aaronchi
Copy link

aaronchi commented Sep 7, 2010

This is how I built it:

  1. Install ruby via rubyinstaller with devkit
  2. Download mysql noinstall win32 package from http://dev.mysql.com/downloads/mirror.php?id=392727#mirrors (x64 doesn't build)
  3. Unpack lib and include directories into somewhere convenient like C:/mysql
  4. Clone mysql2 repo from here
  5. From mysql2 directory run "gem build mysql2.gemspec"
  6. Run "gem install mysql2-0.2.3.gem -- --with-mysql-include=C:/mysql/include --with-mysql-lib=C:/mysql/lib/opt"

Gem builds fine and runs. Some records return data correctly but I get a lot of 'invalid date' errors for whatever reason.

@brianmario
Copy link
Owner

Interesting that I can't seem to even get that far. What version of Windows and DevKit (and/or what compiler) are you using?

@aaronchi
Copy link

aaronchi commented Sep 7, 2010

Just the latest rubyinstaller/devkit (using 1.9.2 but not sure that it would make a difference) I'm running on Windows 7 x64, but again, not sure why that would make a difference. Seems like it works if you have the right mysql libs and are building locally. What error did you run into?

@girlgeek
Copy link

girlgeek commented Sep 7, 2010

I have now backed rails to 2.3.5 so I can no longer replicate, but from my old records:

  1. I am running Windows Vista
  2. With Ruby 1.9.2 and Rails 3.0.0
    attempting any rails command, even 'rails -v' gave
    Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources.
    Try running bundle install.
  3. Running 'bundle install' ran unexceptionally until I hit mysql2 at which point I got
    Installing mysql2 (0.2.3) with native extensions C:/Ruby192/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in b
    uild_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

Those are the errors that I ran into.
Thank you,
Claudia

@luislavena
Copy link
Collaborator

Hey guys, can you please read the comments? There has been no gem release with the fix for this, thus any continuous report about mysql2 not been able to install with Rails 3 is pointless.

Please report feedback with patches on how to solve the issue (see aaronchi comments) and avoid repeat endless things about that you're unable to install it.

@aaronchi
Copy link

aaronchi commented Sep 8, 2010

@luislavena - agreed. It would be good if some more people could validate the install process that I used. Apparently this can be installed and just needs to be debugged on windows.

@girlgeek
Copy link

girlgeek commented Sep 8, 2010

I apologize. I thought that I was responding to a direct question and helping. I have no interest in endless pointless reports.

@brianmario
Copy link
Owner

Hey everyone, I've FINALLY narrowed down what's going on, will post an update soon and hopefully get 0.2.4 released with the first win32 binary :)

@amacgregor
Copy link

Great News Brian!! Hopefully you can solve the last bug rater easily! We all appreciate your hard work.

Cheers

@brianmario
Copy link
Owner

The date parsing bug is the other one, will hopefully have that one fixed before 0.2.5 as well. I may need to push 0.2.5 soon though, and follow up with 0.2.6 soon after.

@brianmario
Copy link
Owner

Just pushed 0.2.5, working on win32 builds of it now - no guarantees though (may have to wait until 0.2.6)

@b4syth
Copy link

b4syth commented Oct 19, 2010

Thanks so much for all your efforts Brian. I will try it out right away.

@brianmario
Copy link
Owner

FYI - I just had a user say they were able to install the gem (even 0.2.4) by doing:

gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.1\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.1\include"'

Obviously the paths to your mysql install may differ, but hopefully that should help!

@luislavena
Copy link
Collaborator

For the record:

http://gist.github.com/635442

Ruby 1.9.2 + DevKit, simple queries seems to work.

@b4syth
Copy link

b4syth commented Oct 20, 2010

The direct gem install procedure with options did not work for me. I had to clone the repository and build the gem that way, as per the steps from luislavena
http://github.com/brianmario/mysql2/issues#issue/8/comment/411481
Also, I still seem to be getting the date parsing problem with my calendar app.

@brianmario
Copy link
Owner

Pushed binary gems with 0.2.6 (the binary gems for 0.2.5 are broken and will be yanked) - Thanks for all the help guys! :) :) :)

@b4syth
Copy link

b4syth commented Oct 20, 2010

Whoah! "gem install mysql2" worked great!
And, touch wood, my calendar app seems to be behaving with date parsing...
For the umpteenth time, Brian, THANKS!

@brianmario
Copy link
Owner

theres an existing ticket for the date bug here: #71 - I'm doing my best to track it down, but I may need to remote connect to someones machine that can reproduce it and debug it there

@brianmario
Copy link
Owner

oh cool! hopefully it's fixed for the users in #71 as well then :)

@b4syth
Copy link

b4syth commented Oct 20, 2010

I have been hitting it hard and no ruby crashes! I am a very happy man.
If I do get problems, I will try to get them reproducible (which was very easy before!) and you can remote connect to my machine. Lets hope that is not necessary as so far so very good...

@b4syth
Copy link

b4syth commented Oct 21, 2010

24 hours later and everything is working great! Good work Brian.

@ollie
Copy link

ollie commented Oct 21, 2010

Thanks man, bloody good work. :)

@ChristianPeters
Copy link

<3

@ghost
Copy link

ghost commented Nov 13, 2010

I just tried

gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.1\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.1\include"'

on Cygwin (Windows XP) with MySQL Server 5.1 installed, but I'm getting:

http://pastie.org/1294766

Does anybody know how to fix it?

@ghost
Copy link

ghost commented Nov 13, 2010

I have Ruby installed through Cygwin. MySQL is installed natively in Windows.

Installing DevKit and reinstalling MySQL with no directory spaces made no difference I'm afraid.

@luislavena
Copy link
Collaborator

@abletony84

You can't mix cygwin with native MySQL. If you use cygwin you need a cygwin mysql.

@ghost
Copy link

ghost commented Nov 13, 2010

Helios-1: Output is the same. Yup, gcc is installed, make too.

luislavena: I've been able to with the old mysql though.

@ghost
Copy link

ghost commented Nov 15, 2010

Anybody know?

@concept47
Copy link

I've been looking forward to getting this gem on windows for a while now but while it installs, my app hangs when it goes to load a page after I start it with either webrick or mongrel.

Just wanted to report that and see if anyone else was having the same problem.
Thanks for all the hard work and caring enough about Windows devs to even try to make this work for us.

@mandrekarsalim
Copy link

im facing the problem while installing the gem mysql2 on windows system. following is the error.
C:>gem i mysql
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

    C:/Ruby192/bin/ruby.exe extconf.rb

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:/Ruby192/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-libmysqllib
--without-libmysqllib

Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8
.1 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/
gem_make.out


please help me if possible

@dw3w4at
Copy link

dw3w4at commented Mar 14, 2011

Okay, thats "mysql" "2.8.1". But, this product is "mysql2" and version is "2.3.6".

@luislavena
Copy link
Collaborator

Also, mysql gem version 2.8.1 is provided in binary form for Windows:

https://rubygems.org/gems/mysql/versions/2.8.1-x86-mingw32

@mandrekarsalim
Copy link

thank u..

prblem solved

@paulsfds
Copy link

paulsfds commented Jun 5, 2011

This might help anyone who is still trying to get this gem to work on Windows 7 64bit, MySQL Server 5.5, and Rails 3.0.7/3.0.8: http://paul-wong-jr.blogspot.com/2011/06/getting-mysql2-gem-to-work-with-ruby-on.html

@luislavena
Copy link
Collaborator

@paulsfds:

You can completely avoid the 32bits installation if you already had the 64bits just by downloading MySQL Connector/C, extracting it somewhere and pointing to that directory during the gem install process, as described in the wiki page.

@rashila
Copy link

rashila commented Aug 31, 2012

I have tried every option, but now I get error as below;

make: gcc: Command not found
Makefile:179: recipe for target `client.o' failed
make: *** [client.o] Error 127

@zhaohongxuan
Copy link

I have already execute sudo apt-get install libmysql-ruby libmysqlclient-dev on my ubuntu, however when I execute sudo gem install mysql2, it still report an error as below:

xuan@xuan-ubuntu:~$ sudo gem install mysql2
[sudo] xuan 的密码: 
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/mysql2-0.4.4/ext/mysql2
/usr/bin/ruby2.3 -r ./siteconf20160622-6358-156a5mc.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql2-0.4.4 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.4/gem_make.out

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests