Issue #8591 has been updated by phasis68 (Heesob Park).


mysql2-0.3.14 gem still fails with version checking with Connect/C 6.1.2.

C:\>irb
DL is deprecated, please use Fiddle
irb(main):001:0> require 'mysql2'
RuntimeError: Incorrect MySQL client library version! This gem was compiled for
6.1.2 but the client library is 6.0.0.
        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:4
5:in `require'
        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:4
5:in `require'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb
:8:in `<top (required)>'
        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:1
10:in `require'
        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:1
10:in `rescue in require'
        from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:3
5:in `require'
        from (irb):1
        from C:/Ruby200-x64/bin/irb:12:in `<main>'

You can detect the wrong library file in extconf.rb like this:

if RUBY_PLATFORM =~ /x64-mingw32/
  abort "-----\nWrong version of libmysql.lib\n-----" unless have_func('__libmysql_lib_iname')
end

The main problem is that linking using an MSVC-generated x64 *.lib file is _not_ supported on mingw-w64 complier.
http://sourceforge.net/apps/trac/mingw-w64/wiki/Answer%2064%20bit%20MSVC-generated%20x64%20.lib

It is desired that MySQL could provide two versions of libmysql.lib, the current mvsc-generated version and mingw-w64 dlltool generated version.



----------------------------------------
Bug #8591: [BUG] Segmentation fault  ruby 2.0.0p195 (2013-05-14) [x64-mingw32]
https://bugs.ruby-lang.org/issues/8591#change-43914

Author: chmel (Josef Chmel)
Status: Third Party's Issue
Priority: Urgent
Assignee: cruby-windows
Category: platform/windows
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14) [x64-mingw32]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


rails server crashes with Segmentation fault
in pure app created with rails new . 
after installing mysql2 gem like this
gem install mysql2 -v '0.3.12b6' -- --with-opt-dir="C:\work\mysqlconnectorc61"

On Windows 7 64b with ruby 2.0 64b in C:\Ruby200-x64 installed by ruby installer rubyinstaller-2.0.0-p195-x64.exe, devkit DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe and mysql connector mysql-connector-c-6.1.0-winx64.msi.

without gem 'mysql2', '~>0.3.12b6' with gem 'sqlite3' server runs fine


-- 
http://bugs.ruby-lang.org/