在 Windows 系统上安装 'wdm' gem 时出错

Error installed 'wdm' gem on Windows system

我在 Windows 7 系统上全新安装了 Ruby 2.2.1(32 位)。我还安装了 devkit,没有任何错误报告。自然地,我认为我可以安装 'wdm' gem 与:

gem install wdm

但是,它出错了。整个输出有点多 post 整个事情所以截断了以下几点。

C:/Ruby22/bin/ruby.exe -r ./siteconf20150318-1712-oq5nlb.rb extconf.rb
checking for main() in -lkernel32... yes
checking for windows.h... yes
checking for ruby.h... yes
checking for HAVE_RUBY_ENCODING_H... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
generating wdm_ext-i386-mingw32.def
compiling entry.c
In file included from entry.c:1:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
...
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
...
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
compiling monitor.c  (this is repeated for multiple *.c files)
...
rb_monitor.o: In function `rb_monitor_run_bang':
C:\Ruby22\lib\ruby\gems.2.0\gems\wdm-0.1.0\ext\wdm/rb_monitor.c:508: undefined reference to `rb_thread_blocking_region'
collect2.exe: error: ld returned 1 exit status
make: *** [wdm_ext.so] Error 1

make failed, exit code 2

我是不是漏掉了什么?

wdm gem 与 2.2 不兼容。它调用函数 rb_thread_blocking_region() ,该函数在 2.0 中被弃用,最后调用 removed in 2.2. Also the gem isn't maintained anymore (see its repository and issue tracker).

您可以分叉存储库,合并 the existing PR that apparently fixes the issue,然后自己构建 gem。使用较旧的 Ruby 版本也可能是一种解决方案。

更新: wdm gem 刚刚更新为 0.1.1。此版本修复了错误。