0

Problem is quite simple, my OS is win 7 x64, I installed DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe, it works well like this:

C:\DevKit>ruby dk.rb install
[INFO] Skipping existing gem override for 'C:/Ruby192'
[WARN] Skipping existing DevKit helper library for 'C:/Ruby192'

C:\DevKit>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
Installing ri documentation for rdiscount-1.6.8...
Installing RDoc documentation for rdiscount-1.6.8...

C:\DevKit>ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello Ru
byInstaller**').to_html"
<p><strong>Hello RubyInstaller</strong></p>

then I'm installing mysql2 like this: gem install mysql2 --platform=ruby

I got the following problem:

gem install mysql2 --platform=ruby
Fetching: mysql2-0.3.10.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

        C:/Ruby192/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... no
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/mysql2-0.
3.10 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.3.10/ext/mysql2/g
em_make.out

what should I do?

thanks a lot!

aaron
  • 1,951
  • 3
  • 27
  • 41

2 Answers2

1

it can't find mysql. did you have installed mysql?

Igor Kapkov
  • 3,779
  • 2
  • 19
  • 19
  • Thanks. and yes, I installed the version mysql-installer-5.5.17.0.msi downloaded from http://dev.mysql.com/downloads/. After the installation, I haven't reboot my system. is that ok? – aaron Nov 20 '11 at 07:36
  • Try `gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'` Of course with your paths. – Igor Kapkov Nov 20 '11 at 07:48
  • oh, got another error: `ERROR: While executing gem ... (NameError)`, `uninitialized constant Psych::Syck`, meanwhile I can find the folder 'c:\Program Files\MySQL\MySQL Server 5.5\lib' but can't find the folder 'c:\Program Files\MySQL\MySQL Server 5.5\lib\opt' – aaron Nov 20 '11 at 07:58
  • 2
    once again `gem install mysql2 --platform=ruby -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'` and add log if it's doesn't help. – Igor Kapkov Nov 20 '11 at 08:06
  • I found in win7 x64, we should use lib path of MYSQL in a different location, like this: `gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\Program Files (x86)\MySQL\MySQL Workbench CE 5.2.35" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'` – aaron Nov 30 '11 at 05:27
0

for windows x86:

gem install mysql2 --platform=ruby -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'

to install specific version, like v 0.3.10

gem install mysql2 -v '0.3.10' --platform=ruby -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'

for windows x64

gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\Program Files (x86)\MySQL\MySQL Workbench CE 5.2.35" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'
aaron
  • 1,951
  • 3
  • 27
  • 41
  • 1
    for x64, installing with version: `gem install mysql2 -v '0.3.7' --platform=ruby -- '--with-mysql-lib="C:\Program Files (x86)\MySQL\MySQL Workbench CE 5.2.35" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'` – aaron Feb 10 '12 at 02:12