Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
947 views
in Technique[技术] by (71.8m points)

mysql - ...mysql2/mysql2.so: [BUG] Segmentation fault ruby 2.0.0p247

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]

How can I get rid of this error?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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://code.google.com/p/structure-svm-map/downloads/detail?name=svm-map-win.zip&can=2&q=)

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

Source: https://bugs.ruby-lang.org/issues/8591


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...