msvcrt-ruby18.dll problem - how do I tell what gems are causing problems?

320 views
Skip to first unread message

Jean Lange

unread,
Oct 4, 2010, 11:49:35 AM10/4/10
to rubyin...@googlegroups.com
I've got a fairly large rails app that my team has been working on, and it runs fine where we normally develop (on Macs) and when we deploy (to Windows and Linux, with a special version of Ruby packaged into our larger product). I'm trying to set up continuous integration testing on a Windows desktop running XP Prof and running into problems when I try to run our Cucumber tests.

I'm using ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] with pik (I also have 1.8.7 installed), and have the same versions of gems installed as a colleague who is not having the problems I am. My specs run fine.

The problem that I'm seeing is that when I run any cucumber scenario, I get the following error twice, whether the scenario passes or fails:
"This application has failed to start because msvcrt-ruby18.dll was not found. Re-installing the application may fix this problem."

I gather from postings here and elsewhere (especially [1]) that my problem is that I've got some gems that won't work for me, and that I need to:
- figure out which gems are causing problems
- reinstall those gems (with the devkit installed) with the --platform option

So, two questions:
- How do I tell which gems are causing problems? I've tried running require 'gemname' in IRB, and got some confusing results - mostly [], ["gemname"], or 'no such file to load'. How do I determine that a gem is or is not working?

- What do the different platforms mean? I kind of assumed that I should be using --platform=mingw32 because I think that's what I've got, but the devkit wiki page [2] seems to say that I should use --platform=ruby regardless of the platform I'm on: "It’s crucial that you include the --platform=ruby option to force RubyGems to build the native gem rather than potentially installing an incorrect binary gem."

Please direct me elsewhere if these questions are not appropriate for here.

[1] - http://www.ruby-forum.com/topic/187997
[2] - http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

Jon

unread,
Oct 4, 2010, 12:13:40 PM10/4/10
to rubyin...@googlegroups.com
> I gather from postings here and elsewhere (especially [1]) that my problem
> is that I've got some gems that won't work for me, and that I need to:
> - figure out which gems are causing problems
> - reinstall those gems (with the devkit installed) with the --platform option

Yes.


> I'm using ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] with pik
> (I also have 1.8.7 installed), and have the same versions of gems installed
> as a colleague who is not having the problems I am. My specs run fine.

If possible, I would suggest moving from 1.9.1p378 to 1.9.2p0 if only just due to the note http://guides.rubyonrails.org/getting_started.html

> - How do I tell which gems are causing problems? I've tried running require
> 'gemname' in IRB, and got some confusing results - mostly [], ["gemname"],
> or 'no such file to load'. How do I determine that a gem is or is not
> working?

"gem list" can help you spot binary gems that contain "mswin" which may indicate a 1.8 mswin binary gem got pulled in. This won't catch all the cases for you. I usually double check a gem's .so shared lib via something like http://www.dependencywalker.com/ to verify it's linked against 1.9 rather than 1.8. It's a bit more time consuming, but you'll know for sure.

Reply with the output of both "gem env" and "gem list" from your 1.9.1 system and maybe we can quickly help you narrow the list down :)


> - What do the different platforms mean? I kind of assumed that I should be
> using --platform=mingw32 because I think that's what I've got, but the
> devkit wiki page [2] seems to say that I should use

> --platform=rubyregardless of the platform I'm on: "It’s crucial that


> you include the
> --platform=ruby option to force RubyGems to build the native gem rather than
> potentially installing an incorrect binary gem."

When you do something like "gem install rdiscount --platform=ruby" *and* have the DevKit installed, this basically causes the Ruby and RubyGem internals to build the gem from source using the DevKit rather than trying to install a binary gem that RubyGems "thinks" is compatible with your system. RubyGems can pull in 1.8 binaries for 1.9.x systems and I suspect this is what happened in your case as the "bad" gems didn't have "fat" 1.8/1.9 binary gems (e.g. - Nokogiri) available.

Jon

Kira Corina

unread,
Oct 27, 2010, 7:18:11 AM10/27/10
to RubyInstaller
Hi Jon,

I've got the same issue. App works fine on Mac, but displays "This
application has failed to start because <b>msvcrt-ruby18.dll</b> was
not found" error on Windows XP.
I only have Ruby 1.9.2p0 installed, no pik. All the gems are fresh
versions.
I've read about the "fat gems", but I still need to work out which gem
exactly fails.

Could you please have a look at my "gem list" and "gem env", maybe
you'll quickly see what the problem is. I'll try the Dependency
Walker, but I don't have much experience with gem files and
dependencies.

Many thanks in advance.

-----------gem env-----------------------------------
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-mingw32]
- INSTALLATION DIRECTORY: E:/Ruby192/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: E:/Ruby192/bin/ruby.exe
- EXECUTABLE DIRECTORY: E:/Ruby192/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- E:/Ruby192/lib/ruby/gems/1.9.1
- E:/Documents and Settings/Admin/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

----------------gem list--------------------------------
*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.1, 3.0.0)
actionpack (3.0.1, 3.0.0)
activemodel (3.0.1, 3.0.0, 3.0.0.rc2)
activerecord (3.0.1, 3.0.0)
activeresource (3.0.1, 3.0.0)
activesupport (3.0.1, 3.0.0, 3.0.0.rc2)
acts-as-taggable-on (2.0.6)
addressable (2.2.2)
arel (1.0.1)
arrayfields (4.7.4)
autotest (4.4.1)
autotest-rails (4.1.0)
babosa (0.2.0)
bcrypt-ruby (2.1.2)
builder (2.1.2)
bundler (1.0.3)
cancan (1.4.0)
capistrano (2.5.19)
chronic (0.2.3)
churn (0.0.12)
colored (1.2)
compass (0.10.5)
configuration (1.1.0)
cucumber (0.9.3, 0.9.2)
cucumber-rails (0.3.2)
database_cleaner (0.6.0, 0.5.2)
devise (1.1.3)
diff-lcs (1.1.2)
email_spec (1.0.0)
erubis (2.6.6)
factory_girl (1.3.2)
faraday (0.5.1, 0.4.6)
fattr (2.1.0)
flay (1.4.1)
flog (2.5.0)
friendly_id (3.1.7)
gem_plugin (0.2.3)
gherkin (2.2.9 x86-mingw32)
globalize3 (0.0.7)
haml (3.0.22, 3.0.21)
has_scope (0.5.0)
heroku (1.11.0)
high_voltage (0.9.2, 0.9.1)
highline (1.6.1)
hirb (0.3.4)
hoe (2.6.2)
i18n (0.4.2, 0.4.1)
inherited_resources (1.1.2)
json (1.4.6 x86-mingw32)
json_pure (1.4.6)
launchy (0.3.7)
mail (2.2.9, 2.2.7)
main (4.2.0)
meta-tags (1.2.3)
metric_fu (1.5.1)
mime-types (1.16)
minitest (1.6.0)
mongrel (1.2.0.pre2 x86-mingw32)
multi_json (0.0.4)
multipart-post (1.0.1)
mysql (2.8.1 x86-mingw32)
net-ldap (0.1.1)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.0.23)
net-ssh-gateway (1.0.1)
newrelic_rpm (2.13.2)
nokogiri (1.4.3.1 x86-mingw32)
oa-basic (0.1.6, 0.1.4)
oa-core (0.1.6, 0.1.4)
oa-enterprise (0.1.6, 0.1.4)
oa-oauth (0.1.6, 0.1.4)
oa-openid (0.1.6, 0.1.4)
oauth (0.4.3)
oauth2 (0.1.0, 0.0.13)
omniauth (0.1.6, 0.1.4)
pg (0.9.0 x86-mingw32)
polyglot (0.3.1)
progressbar (0.9.0)
pyu-ruby-sasl (0.0.3.2)
rack (1.2.1)
rack-mount (0.6.13)
rack-openid (1.2.0, 1.1.2)
rack-test (0.5.6)
radius (0.6.1)
rails (3.0.1, 3.0.0)
rails_best_practices (0.4.6)
rails_config (0.1.8, 0.1.6)
railties (3.0.1, 3.0.0)
rake (0.8.7)
rcov (0.9.9)
rdiscount (1.6.5)
rdoc (2.5.8)
redcar (0.7)
reek (1.2.8)
responders (0.6.2)
rest-client (1.6.1)
riddle (1.1.0)
roodi (2.1.0)
rspec (2.0.1, 2.0.0)
rspec-core (2.0.1, 2.0.0)
rspec-expectations (2.0.1, 2.0.0)
rspec-mocks (2.0.1, 2.0.0)
rspec-rails (2.0.1)
ruby-openid (2.1.8)
ruby-openid-apps-discovery (1.2.0)
ruby2ruby (1.2.5)
ruby_parser (2.0.5)
rubyforge (2.0.4)
rubyntlm (0.1.1)
rubyzip (0.9.4)
Saikuro (1.1.0)
sentient_user (0.3.0)
sexp_processor (3.0.5)
shoulda (2.11.3)
simple-navigation (3.0.1, 3.0.0)
simple_form (1.2.2)
sitemap_generator (1.2.3, 1.2.1)
sqlite3-ruby (1.3.1 x86-mingw32)
state_machine (0.9.4)
term-ansicolor (1.0.5)
thinking-sphinx (2.0.0.rc2)
thor (0.14.3)
timeline_fu (0.3.0)
treetop (1.4.8)
tzinfo (0.3.23)
warden (0.10.7)
webrat (0.7.2, 0.7.1)
will_paginate (3.0.pre2)
ZenTest (4.4.0)

Luis Lavena

unread,
Oct 27, 2010, 9:53:44 AM10/27/10
to rubyin...@googlegroups.com
On Wed, Oct 27, 2010 at 8:18 AM, Kira Corina <kira....@gmail.com> wrote:
> Hi Jon,
>
> I've got the same issue. App works fine on Mac, but displays "This
> application has failed to start because <b>msvcrt-ruby18.dll</b> was
> not found" error on Windows XP.
> I only have Ruby 1.9.2p0 installed, no pik. All the gems are fresh
> versions.
> I've read about the "fat gems", but I still need to work out which gem
> exactly fails.
>
> Could you please have a look at my "gem list" and "gem env", maybe
> you'll quickly see what the problem is. I'll try the Dependency
> Walker, but I don't have much experience with gem files and
> dependencies.
>

Hello Kira,

Once you receive the popup telling you the missing gem, either on the
Rails log file or the console will display a line telling you failed
to require "xxx" file (LoadError)

Please locate that line which will provide us information on which gem
failed to require.

Also, from your list of gems, look at the ones that tells you a
precise platform has been installed (x86-mingw32) which indicates a
binary gem was installed.

From the top of my head from your gem list I can tell you JSON is not
fat-binary compatible and you need to uninstall it and install from
source

gem install json --platform=ruby

(Having the DevKit installed)

--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Jon

unread,
Oct 27, 2010, 10:22:43 AM10/27/10
to rubyin...@googlegroups.com
> json (1.4.6 x86-mingw32)

This is the first one that jumps out as a problem. If it's the binary gem I think it is, it's 'parser.so' and 'generator.so' (in the gems lib\json\ext dir) links with msvcrt-ruby18.dll and is definitely a source of problems when running 1.9.2-p0.

To fix, you need to uninstall it and reinstall json and build the gem from source using the DevKit [1] and "gem install json --platform=ruby"

There may be others, but double check that json is correct first.

FWIW, while I believe the 'mysql' gem supports both 1.8/1.9, Yehuda had a blog [2] in which he talked about 'mysql2' and Rails3 from a threading perspective. As I don't use MySQL I don't know if your 'mysql' gem is the right one to use, but definitely double check. Search this list for previous discussions as Luis is *very* much involved with MySQL and Ruby on Windows...you may want to search his blog [3] as well.

Jon


[1] http://github.com/oneclick/rubyinstaller/wiki/Development-Kit
[2] http://yehudakatz.com/2010/08/14/threads-in-ruby-enough-already/
[3] http://blog.mmediasys.com/

Octagon

unread,
Oct 28, 2010, 1:30:47 AM10/28/10
to RubyInstaller

On Oct 4, 7:49 pm, Jean Lange <jean.f.la...@gmail.com> wrote:
> - How do I tell which gems are causing problems?

1. Figure out what kind of problems "gems are causing". In your case
it is inability to load a dll.
2. Figure out what can attempt to load a dll. In your case it is a .so
or .dll file. Hint: gems compatible with RubyInstaller/DevKit should
use only .so files.
3. Figure out which .so or .dll file requires msvcrt-ruby18.dll. This
is a generic Windows task with lots of generic Windows tools to solve.
Hint: normally dependent dlls are listed inside as plain text inside
the caller module.
4. Find the gem causing the problem moving up the folder tree from the
problem .so file!

Kira Corina

unread,
Oct 28, 2010, 3:17:59 AM10/28/10
to RubyInstaller
Oh thank you guys! With all these hints, I finally found this was
JSON, you were so right!

After this popup-error-window, console said there was something wrong
with Sphinx (I use it via Thinking-sphinx gem), and logs were packed
with multiple Pg messages. But JSON was the one referencing to "msvcrt-
ruby18.dll". So I've uninstalled it and installed with --
platform=ruby, and now everything works fine.

Thanks again, you're doing a great job!

Kira Corina

unread,
Oct 28, 2010, 3:18:53 AM10/28/10
to RubyInstaller
Oh thank you guys! With all these hints, I finally found this was
JSON, you were so right!

After this popup-error-window, console said there was something wrong
with Sphinx (I use it via Thinking-sphinx gem), and logs were packed
with multiple Pg messages. But JSON was the one referencing to "msvcrt-
ruby18.dll". So I've uninstalled it and installed with --
platform=ruby, and now everything works fine.

Thanks again, you're doing a great job!


On 28 окт, 08:30, Octagon <g...@kaluga.ru> wrote:

Kira Corina

unread,
Oct 28, 2010, 6:26:35 AM10/28/10
to RubyInstaller
Jon, thanks also for this mysql tip I didn't know about.
Reply all
Reply to author
Forward
0 new messages