gem not working in Cygwin

A way to fix this without changing the rvm build process is:

ln -s /cygdrive/c/Windows/System32/kernel32.dll /usr/lib/kernel32

This happens because ruby is looking for a shared library named simply kernel32. Cygwin 2.5.1 and earlier automatically added the ".dll" extension to shared library loads. But cygwin 2.5.2 introduced a patch requiring full shared library filenames. Adding a symbolic link within the library search path (/usr/lib) allows the library to be found even when loaded with the old-style name.


I installed ruby using rvm so the updated Cygwin ruby binaries weren't much help and I didn't really want to downgrade my Cygwin installation - how would I know when it was safe to upgrade again?

Following the information in Michael D's answer, the problem appears to be in the resolv.rb file located in ~\.rvm\rubies\ruby-<version>\lib\ruby\<version>\win32 (in my case ~\.rvm\rubies\ruby-2.1.7\lib\ruby\2.1.0\win32).

Somewhere near the top of this file, there is the code

module Kernel32
  extend Importer
  dlload "kernel32"
end

Simply changing the dlload "kernel32" line to dlload "kernel32.dll" seemed to fix it for me. Alternatively using the full path

dlload "c:/Windows/System32/kernel32.dll"

also worked, but it seems to be the extension that is the crucial bit (the full path without the extension also doesn't work).

This may have been fixed in a more recent version of rvm, but I didn't want to go through the hassle of updating and reinstalling, so this works for me. Or course this would likely need to be changed for all installed rubies.


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