Whilst migrating my development environment to a new machine, I kept getting “The application failed to initialize properly (0xc0000022).” errors when trying to run ruby.
First, some background. We keep all our tools, including the entire ruby installation and all associated gems in a Subversion repository. We’ve been burned in the past by changes in tools or libraries causing subtle or not-so-subtle bugs. Yes, the initial check-in and check-out is painful, but not so painful as trying to debug a new installation that has a different version of a library or gem.
So when I got a new laptop, I just checked out “tools/trunk” from our SVN repository and was ready to go.
Not quite.
When I tried to run “ruby -v” from Z shell (under Cygwin), nothing happened. Nada, zip, zilch. Just got the command prompt back. Remembering that sometimes zsh “forgets” to show you Windows errors, I tried it in a Command Prompt window, that’s when I got the above error.
Some judicious Googling found this entry (thanks Corey!) on the possibility that Windows DLL permissions may be to blame. So I opened a command prompt window (zsh has some problems with escape characters) and ran the commands he suggests:
CACLS %systemroot%\System32\*.dll /E /G BUILTIN\Users:R
and
CACLS %systemroot%\System32\*.ocx /E /G BUILTIN\Users:R
Et voila, same problem.
After thinking about this for a while, I realized it was probably not the Windows/system32 DLL’s that were the problem, but the DLL’s in ruby install directory. So I navigated to my ruby install directory and ran the command:
CACLS *.dll /T /E /G BUILTIN\Users:R
and
CACLS *.so /T /E /G BUILTIN\Users:R
Problem solved! Hope this saves someone else some head-scratching.
Leave a Reply