在Windows 7上启动rails

时间:2014-02-07 21:01:25

标签: ruby-on-rails ruby-on-rails-4

我配置一个rails simple_app运行此命令

rails new simple_app -d mysql

现在,当我尝试启动rails服务器时,我得到了

 515 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/atom_feed_helper.rb
 516 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/cache_helper.rb
 517 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/controller_helper.rb
 518 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/csrf_helper.rb
 519 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/date_helper.rb
 520 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/debug_helper.rb
 521 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/javascript_helper.rb
 522 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/core_ext/array/access.rb
 523 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/url_helper.rb
 524 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/core_ext/string/filters.rb
 525 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/sanitize_helper.rb
 526 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/text_helper.rb
 527 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/form_tag_helper.rb
 528 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/tags.rb
 529 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/model_naming.rb
 530 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/form_helper.rb
 531 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/form_options_helper.rb
 532 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/number_helper.rb
 533 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/number_helper.rb
 534 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/output_safety_helper.rb
 535 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/core_ext/module/qualified_const.rb
 536 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/core_ext/module.rb
 537 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/record_identifier.rb
 538 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/record_tag_helper.rb
 539 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/rendering_helper.rb
 540 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers/translation_helper.rb
 541 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_view/helpers.rb
 542 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/helper.rb
 543 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/engine/configuration.rb
 544 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/configuration.rb
 545 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/railtie.rb
 546 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/all.rb
 547 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/string_inquirer.rb
 548 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2/version.rb
 549 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2/error.rb

我多次删除了这个并试图再次这样做。


这似乎解决了分段错误问题


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

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

要生成libmysql.lib文件,需要gendef.exe,它可以从mingw-w64发行版中获取

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

gendef.exe libmysql.dll

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

gendef.exe运行gem命令后:gem install mysql2 --no-rdoc --no-ri - ' - with-mysql-lib =“C:\ Program Files \ MySQL \ MySQL Server 5.6 \ lib” --with-mysql-include =“C:\ Program Files \ MySQL \ MySQL Server 5.6 \ include”'

它不适用于Windows上的命令[--with-opt-dir](我在Windows 7上这样做了)

使用最新的MySQL版本

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

0 个答案:

没有答案