From: "phasis68 (Heesob Park)" Date: 2013-07-03T14:54:14+09:00 Subject: [ruby-core:55771] [ruby-trunk - Bug #8591] [BUG] Segmentation fault ruby 2.0.0p195 (2013-05-14) [x64-mingw32] Issue #8591 has been updated by phasis68 (Heesob Park). The libmysql.lib included in the MySQL Connector/C 64 bit is not compatible with the mingw64-gcc compiler. You need to generate mingw64 compatible libmysql.lib file. To generate libmysql.lib file, you need gendef.exe, which can obtain from mingw-w64 distribution(I got from https://structure-svm-map.googlecode.com/files/svm-map-win.zip) In the lib folder of the mysql connector, produce libmysql.lib with the following steps. gendef.exe libmysql.dll dlltool -v --dllname libmysql.dll --def libmysql.def --output-lib libmysql.lib And running the normal gem install command. gem install mysql2 -v '0.3.12b6' -- --with-opt-dir="..." NOTE: In case of MySQL Connector/C 6.1, due to the version comparison routine, you cannot use mysql2 module with the following exception. RuntimeError: Incorrect MySQL client library version! This gem was compiled for 5.7.2-m12 but the client library is 6.1.0. You should use mysql-connector-c-6.0.2-winx64.msi in http://dev.mysql.com/downloads/connector/c/6.0.html#downloads ---------------------------------------- Bug #8591: [BUG] Segmentation fault ruby 2.0.0p195 (2013-05-14) [x64-mingw32] https://bugs.ruby-lang.org/issues/8591#change-40266 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/