Ruby on Rails Win7 x64?

时光总嘲笑我的痴心妄想 提交于 2020-01-01 19:31:28

问题


I've just upgraded to Win7 x64 Professional and wanted to recommence developing my Rails Apps, however I'm getting the following error :

=> Booting Mongrel
=> Rails 2.3.5 application starting on http://127.0.0.1:3344
D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:271:in `require_frameworks': 193: %1 is not a valid Win32 application.   - D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/1.8/i386-mswin32/openssl.so (RuntimeError)
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:134:in `process'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from D:/nu codes/R/Aptana/tempproj/config/environment.rb:9
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from D:/nu codes/R/ruby-1.8.7-p174-i386-mswin32/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from D:/nu codes/R/Aptana/tempproj/script/server:3
from -e:1:in `load'
from -e:1

Process finished with exit code 1

while trying to run the server. I've alleviated all the errors regarding OpenSSL and Iconv by copying the required .dll s into my ruby\bin directory. I'm stumped about this one, could it be that I'm running x64 now ? I have no idea, at least the other stack traces named the .dll which was causing it.

Gem listing :

*** LOCAL GEMS ***
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
authlogic (2.1.3)
cgi_multipart_eof_fix (2.5.0)
gem_plugin (0.2.3)
mongrel (1.1.5)
mysql (2.8.1)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)

I'm also running MySQL v5.1.41-community. I will try installing MySQL 5.0.

  • Update : I must say that I never do use OpenSSL in the Project, so I must say I am quite baffled that it is required in the first place. Trying to see if it was a Rails error, I've created a dummy app (rails bla) and rails wouldn't even create the default skeleton since some random error ( "raise NotImplementedError, "No random device" ) popped up at "activesupport/lib/active_support/secure_random.rb" . I've googled that and replaced it with another version from github. That created the skeleton, but trying to run the server I get the same error, even if it's the Rails default dummy app. I will try to hack into that file again, again no idea what OpenSSL is doing here in the first place and requiring DLLs.

At a loss, any help would be appreciated. Thanks in advance !


回答1:


It was a DLL problem after all, went 1.8.6, x32 MySQL and OpenSSL, unpacked every dll mentioned in this excellent blog post and it's all running smoothly again, gosh ! And yes, I've answered my own question after all :-) Thank you !




回答2:


This helped me from https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-fraps_violation


After investigation, having tools that alter loading DLLs (like FRAPS or Detours) can affect loading Ruby’s extensions.

It is recommended you disable/uninstall FRAPS.


That fixed it for me.




回答3:


For Rails or DataMapper or whatever to talk to MySQL you need a 32-bit driver in Rails\bin. The driver is called libmysql.dll. Even if you have a 64-bit server you need a 32-bit driver.

64-bit driver will fail will ruby/gems/1.8/gems/do_mysql-0.10.2-x86-mingw32/lib/do_mysql/1.8/do_mysql.so: 193: %1 is not a valid Win32 application.

a wrong 32-bit version will crash with memory allocation error or something weird like that




回答4:


LoadError: 193: %1 is not a valid Win32 application. I got this msg when I tried to load mysql ruby gem in irb. The problem: The libmysql.dll MUST be the same version of mysql found in history.txt of the ruby mysql gem

The fix: (1) Go the the readme.txt and history.txt for the mysql gem and verify the mysql version. (2) Install the corresponding mysql version. (3) Copy the libmysql.dll file from the mysql bin dir to the ruby bin dir. (4) Return to ruby irb and enter "require 'rubygems'" then "require 'mysql'" (5) Say "yeaaah" when you see "true"! Note: You may not really need to install the needed mysql version to get the proper libmysql.dll file. I just found it easier to just install it. If you are like me, this problem was so vexing I thought of giving up on writing the program. So, I hope this solution restores your confidence.




回答5:


See if this helps: http://www.technipages.com/error-193-1-is-not-a-valid-win32-application.html

From what is mentioned in this article, do you have a folder called "nu" in your D:/ drive? If yes, try renaming it and check if the server runs fine.



来源:https://stackoverflow.com/questions/1966124/ruby-on-rails-win7-x64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!