6
1
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.
Problem solved https://www.cygwin.com/ml/cygwin-announce/2016-06/msg00054.html
– matzeri – 2016-06-28T07:59:49.423"Problem solved" That only fixes the problem when you install Ruby through the Cygwin installer, right? I'm getting this error while trying to install via RVM, so I guess my only option is to downgrade Cygwin. – Ajedi32 – 2016-07-13T16:58:09.170
If ruby is not installed with "Cygwin installer" than is not a a cygwin programs and I do not see why it should care about cygwin dll loader. – matzeri – 2016-07-14T06:11:24.960
RVM works by downloading and compiling Ruby from source. So if you're running it in a Cygwin environment, then the resulting binaries will be a "Cygwin program". Anyway, downgrading Cygwin to 2.5.1 did resolve my problem. – Ajedi32 – 2016-07-14T13:00:01.293
@Ajedi32, in case this is still a problem for you, I posted an answer for RVM installed rubies below. I didn't really want to downgrade my Cygwin version! – zelanix – 2016-08-06T08:06:26.217