本文介绍了... mysql2/mysql2.so:[BUG]细分错误ruby 2.0.0p247的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows7x64,ruby2.0.0p247,rails4.0.0和mysql5.5.27.
当我运行$ rails server命令时,出现以下错误.

I'm using windows7x64, ruby2.0.0p247, rails4.0.0 and mysql5.5.27.
When I run the $ rails server command, I got the following error.

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/lib/mysql2/mysql2.so: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27) [x64-mingw32]

如何摆脱这个错误?

推荐答案

MySQL Connector/C 64位中包含的libmysql.lib与mingw64-gcc编译器不兼容.

The libmysql.lib included in the MySQL Connector/C 64 bit is not compatible with the mingw64-gcc compiler.

您需要生成与mingw64兼容的libmysql.lib文件.

You need to generate mingw64 compatible libmysql.lib file.

要生成libmysql.lib文件,您需要gendef.exe,该文件可以从mingw-w64发行版获得(我从 https://code.google.com/p/structure-svm-map/downloads/detail? name = svm-map-win.zip& can = 2& q = )

To generate libmysql.lib file, you need gendef.exe, which can obtain from mingw-w64 distribution(I got from https://code.google.com/p/structure-svm-map/downloads/detail?name=svm-map-win.zip&can=2&q=)

在mysql连接器的lib文件夹中,按照以下步骤生成libmysql.lib.

In the lib folder of the mysql connector, produce libmysql.lib with the following steps.

gendef.exe libmysql.dll

gendef.exe libmysql.dll

dlltool -v --dllname libmysql.dll --def libmysql.def --output-lib libmysql.lib

dlltool -v --dllname libmysql.dll --def libmysql.def --output-lib libmysql.lib

并运行普通的gem install命令. gem install mysql2 -v'0.3.12b6'---with-opt-dir ="..."

And running the normal gem install command. gem install mysql2 -v '0.3.12b6' -- --with-opt-dir="..."

注意:对于MySQL Connector/C 6.1,由于版本比较例程的缘故,不能使用mysql2模块,但以下情况除外. RuntimeError:错误的MySQL客户端库版本!该gem是为5.7.2-m12编译的,但是客户端库是6.1.0.

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.

您应在 http://dev.mysql.com/downloads/connector/c/6.0.html#downloads

来源: https://bugs.ruby-lang.org/issues/8591

这篇关于... mysql2/mysql2.so:[BUG]细分错误ruby 2.0.0p247的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 14:52