From: Eric Christopherson Date: 2010-01-16T09:29:42+09:00 Subject: Re: Building mysql extension/gem with MinGW (was Re: Gem build issues Ubuntu 9.10 64 bit) On Fri, Jan 15, 2010 at 2:05 PM, Luis Lavena wrote: > On Jan 14, 9:11 pm, Eric Christopherson > wrote: >> >> wrote: >> > Since people are talking about the mysql gem, I thought I'd ask how >> > you can build it under MinGW. I can't seem to make any combination of >> > extconf switches work. >> > > --with-mysql-dir is the only switch that you need, or --with-mysql- > include and --with-mysql-lib OK. Using the instructions below, just --with-mysql-dir doesn't quite work (perhaps because the libs aren't right in lib/), but -include with -lib works. > >> > I have the standard Windows mysql-5.1.42-win32 installed in >> > /usr/local/mysql. Do I need some MinGW-specific version? (I've tried >> > compiling it from source with MSYS/MinGW and also Cygwin, with no >> > success.) >> > > You're talking about RubyInstaller and combined with DevKit, correct? > > If so, then don't install form inside bash or use *nix like paths. Ah, yes. OK. > > If you have MySQL 5.1, you need: > > 1) RubyInstaller 1.9.1 installed > 2) DevKit installed and configured (edit fstab as indicated in the > wiki) > > http://wiki.github.com/oneclick/rubyinstaller/development-kit > > 3) From a Windows prompt, ensure Ruby and GCC works: > > ruby -v > gcc --version > > 4) Have MySQL installed and know the path where its library is. If you > manually extracted it form the zip, remember the location. > > 5) proceed to gem installation and indicate the "ruby" platform to > force the compilation. Now use the path to MySQL > > gem install mysql --platform ruby -- --with-mysql-include=C:/mysql/ > include --with-mysql-lib=C:/mysql/lib/opt > > I've indicated "opt" as library because is the "opt"imized version. > > Please note that extracting or installing MySQL or Ruby or gems in a > path with spaces can be a problem. Try avoiding them to all cost. > > Hope that helps. Yes, that allows me to build the gem with no problems. However, I would still like to build from the tarball (since I am working on a modified version of it). I used this command line to find out what exact steps gem was taking: gem install mysql --verbose --platform ruby -- --with-mysql-include=C:/MySQL/include --with-mysql-lib=C:/MySQL/lib/opt That showed, as expected, that the extconf command line is: C:/Ruby/bin/ruby.exe extconf.rb --with-mysql-include=C:/MySQL/include --with-mysq l-lib=C:/MySQL/lib/opt But when I issue this command myself in the source directory, extconf fails to find mysql_query. What am I doing wrong? I am using cmd.exe for both, and my environment should be the same. I wonder if gem has its own environment that it passes to ruby/extconf.