On a freshly installed Windows 7 Professional 64 Bit I installed Cygwin (64) and some of its packages, including Ruby. I have also installed Ruby using the Ruby installer, because I'll likely need it for both the default Windows shells and Cygwin.
Now when I try to execute a gem
command like gem list
or gem install foo
, I get a weird error I failed to solve within the last few hours of searching the internet.
$ which ruby
/usr/bin/ruby
$ which gem
/usr/bin/gem
$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-cygwin]
$ gem -v
2.4.8
$ gem list
ERROR: Loading command: list (Fiddle::DLError)
can't load kernel32
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
$ gem install sass
ERROR: Loading command: install (Fiddle::DLError)
can't load kernel32
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
However, with the native Windows version, from the Windows CMD, it works without any problems. I cannot however use native Windows Ruby stuff from Cygwin, because that gives me errors, but that's not the question here anyway.
With Process Monitor I figured out that Ruby tries to open C:\cygwin64\bin\kernel32.dll
and fails, because that file is not there. I tried copying the kernel32.dll
from C:\Windows\System32
and the one from C:\Windows\SysWOW64
into that Cygwin bin
folder and still got the same error (apart from that it then said can't load kernel32.dll), although the Process Monitor didn't show a NAME NOT FOUND
error anymore.
What magic is happening here? I'd really like to understand what's wrong here. I appreciate any help.
Best Answer
It seems a unexpected result of cygwin 2.5.2 release
https://www.cygwin.com/ml/cygwin/2016-06/msg00378.html
As workaround, downgrade cygwin package to 2.5.1