On Fri, Jan 15, 2010 at 6:29 PM, Eric Christopherson
<echristopherson / gmail.com> wrote:
> On Fri, Jan 15, 2010 at 2:05 PM, Luis Lavena <luislavena / gmail.com> wrote:
>> On Jan 14, 9:11 ¨Âí¬ Åòéã Ãèòéóôïðèåòóïî ¼åãèòéóôïðèåò®®®Àçíáéì®ãïí>> wrote:
>>>
>>> <echristopher... / gmail.com> 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.

I just discovered that building the gem actually works fine in MSYS
also; and I can either use DOS-style or Unix-style pathnames for the
MySQL directories.

>
>>
>> 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:
>
>  ¨Âåí éîóôáìíùóñ­­öåòâïó­­ðìáôæïòí òõâù ­­
> --with-mysql-include=C:/MySQL/include
> --with-mysql-lib=C:/MySQL/lib/opt
>
> That showed, as expected, that the extconf command line is:
>
>  ¨Âº¯Òõâù¯âéî¯òõâù®åøåøôãïîæ®òâ
> --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.

I'm still trying to figure out this aspect of the problem. At least
compiling the extension through gem fixed a bug I saw with the binary
gem -- before, the query method always failed, saying it was not
connected, even though I had connected successfully (as demonstrated
by #list_dbs and #list_tables).

OT: I'm just starting to use Gmail for mailing lists. I notice that it
keeps incorrectly considering some of my original text as quotations,
while some quotations it doesn't detect as such. Is there any way to
fix that?