2

When I try to create a Rails server this is what I get. It instantly runs over 500+ lines of code and comes back with this message. This is my first Ruby on Rails project. I am pretty new to coding as well. Would love some help if possible. Thank you!

C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/my
sql2/mysql2.so: [BUG] Segmentation fault
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]


    0 enumerator.so
    1 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/encdb.so
    2 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/iso_8859_1.so
    3 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/trans/transdb.so
    4 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/rbconfig.rb
    5 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/compatibility.rb
    6 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/defaults.rb
    7 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/deprecate.rb
    8 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/errors.rb
    9 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/version.rb
   10 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/requirement.rb
   11 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/platform.rb
   12 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/basic_specification.rb
   13 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/stub_specification.rb
   14 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/util/stringio.rb
   15 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb
   16 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/exceptions.rb
   17 C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/defaults/operating_system.rb
   18 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/utf_16le.so
   19 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/trans/utf_16_32.so
   20 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb


  537 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_sup
port/core_ext/module.rb
  538 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/r
ecord_identifier.rb
  539 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers/record_tag_helper.rb
  540 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers/rendering_helper.rb
  541 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers/translation_helper.rb
  542 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers.rb
  543 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.0.1/lib/sprocket
s/rails/helper.rb
  544 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/engine/co
nfiguration.rb
  545 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/applicati
on/configuration.rb
  546 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.0.1/lib/sprocket
s/railtie.rb
  547 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/all.rb
  548 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_sup
port/string_inquirer.rb
  549 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2/version.r
b
  550 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2/error.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:\Users\MVParker\Documents\Sites\simple_cms>
Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
MVParker
  • 23
  • 4
  • Can you try to grab the first 10-15 lines of the stack trace? The above is the very end. Maybe the mysql binaries are not installed...just a guess. Will know more with the rest of the stack. – steakchaser Apr 30 '14 at 19:18
  • i added the first 20 lines of code does that help? – MVParker Apr 30 '14 at 19:35
  • Not really. Technically this is a segfault so it is spitting out a snapshot of every single thing that was loaded at the time it crapped out. Can you find any line that indicates an actual error? Maybe search for "Exception". – steakchaser Apr 30 '14 at 19:43
  • the bug is a segmentation fault, still cant fix it tho – MVParker Apr 30 '14 at 19:44
  • i added the bug to the code now im pretty sure that is what you're looking for, sorry im new to all of this, im sure i sound like someone who has no idea what they are talking about lol, really appreciate the help tho – MVParker Apr 30 '14 at 19:46
  • I have a feeling your using Windows 7 and probably a 64 bit processor. mysql2 does not like that. You might need to change a few things in your gemlock file. check out this post: http://stackoverflow.com/questions/17350837/ruby-on-rails-add-gem-sqlite3-to-your-gemfile – TheJKFever Apr 30 '14 at 21:21

2 Answers2

4

Following the answer from Dave Schweisguth, about the ruby bug, and doing the steps described by Heesob Park's comment, I could get mysql2 gem to work. Thank you guys for sharing this.

Quote from Heesob comment:

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 create an compatible libmysql.lib file, I did the following steps: (I'm running Win8.1 x64 with Ruby 2.0.0p481 [x64-mingw32])

1) Downloaded this zip file https://structure-svm-map.googlecode.com/files/svm-map-win.zip and extracted it to a c:\tmp\svm-map

2) Downloaded Mysql C/Connector 6.1 from http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.1.3-winx64.zip and extracted it to c:\tmp\mysql

3) Open CMD Prompt

4) cd \tmp\svm-map\python-mingw-lib

5) gendef.exe \tmp\mysql\lib\libmysql.dll

6) move libmysql.def \tmp\mysql\lib

7) cd \tmp\mysql\lib

8) \Ruby200-x64\DevKit\mingw\bin\dlltool -v --dllname libmysql.dll --def libmysql.def --output-lib libmysql.lib

9) gem install mysql2 -- --with-mysql-dir=c:\tmp\mysql

That´s it! Mysql2 gem running on Rails x64 on Windows 8.1! =)

Fernando Vieira
  • 3,177
  • 29
  • 26
1

I googled "x64-mingw32 mysql2 Segmentation fault" and found this: https://bugs.ruby-lang.org/issues/8591

Looks like there is a bug in mysql2. A comment on the Ruby issue gives a workaround, regenerating libmysql.lib with your compiler. Please report back and let us know if it works.

Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
  • this is my first time ever working with ruby this is all kinda over my head lol, im trying tho – MVParker Apr 30 '14 at 21:46
  • I'm afraid Ruby is like this sometimes, because it depends so heavily on compiling against external libraries. Working on Windows makes it harder, because Macs are more popular among Rubyists and bugs are addressed sooner on Macs. Have you tried something like http://railsinstaller.org/, or can you work on a Mac instead? – Dave Schweisguth Apr 30 '14 at 21:56
  • no i have no way of working on a mac, i adjusted a few things and now im not getting that same error i think the rails server worked other than i still cant connect to loaclhost:3000 – MVParker Apr 30 '14 at 22:15
  • i added what i am getting now does that mean it worked? if so then why can i not access localhost:3000 – MVParker Apr 30 '14 at 22:20
  • I suggest posting the adjustments that you made that solved the problem as an answer to this question, removing that new error from this question, and starting a new question for your new issue. – Dave Schweisguth Apr 30 '14 at 22:26
  • the adjustments i made that solved my problems where on the link that you gave me. – MVParker Apr 30 '14 at 22:29
  • Ah, got it, I see it's accepted, thanks. I think you will still want to start a new question for your new issue. – Dave Schweisguth Apr 30 '14 at 22:30
  • alright i will but idk what the issue even is, did my Rails Server work there or not lol? – MVParker Apr 30 '14 at 22:33
  • I think you just need to change to your Rails app's root directory before typing `rails s`. – Dave Schweisguth Apr 30 '14 at 22:35