安装 oily_png 时无法构建本机扩展

Failed to build native extension while installing oily_png

我很难安装我的 Ruby 项目所需的 gem(基于 Cucumber 和 SitePrism 的自动化测试,但我认为这不相关)。

输出表明本机扩展有问题,但我确实安装了 devkit 并且之前使用它没有任何问题。

$ gem install oily_png -v '1.1.2'
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing oily_png:
        ERROR: Failed to build gem native extension.

    c:/Ruby193/bin/ruby.exe -r ./siteconf20150430-6252-1aexxhi.rb extconf.rb

creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

Gem files will remain installed in 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/oily_png-1.1.2 for inspection.
Results logged to
c:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/oily_png-1.1.2/gem_make.out

gem_make.out(双关语?)日志文件的内容如下

c:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

make  clean

make
generating oily_png-i386-mingw32.def
compiling color.c
compiling oily_png_ext.c
oily_png_ext.c: In function 'Init_oily_png':
oily_png_ext.c:13:3: warning: ISO C90 forbids mixed declarations and code
oily_png_ext.c:17:3: warning: ISO C90 forbids mixed declarations and code
oily_png_ext.c:21:3: warning: ISO C90 forbids mixed declarations and code
oily_png_ext.c:30:3: warning: ISO C90 forbids mixed declarations and code
compiling operations.c
operations.c: In function 'oily_png_compose_bang':
operations.c:28:3: warning: ISO C90 forbids mixed declarations and code
operations.c:41:3: warning: ISO C90 forbids mixed declarations and code
operations.c:51:3: warning: ISO C90 forbids mixed declarations and code
operations.c: In function 'oily_png_replace_bang':
operations.c:84:3: warning: ISO C90 forbids mixed declarations and code
operations.c:97:3: warning: ISO C90 forbids mixed declarations and code
operations.c:107:3: warning: ISO C90 forbids mixed declarations and code
compiling png_decoding.c
png_decoding.c: In function 'oily_png_decode_filter_up':
png_decoding.c:20:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_grayscale_1bit':
png_decoding.c:98:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_grayscale_2bit':
png_decoding.c:110:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_grayscale_4bit':
png_decoding.c:122:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_grayscale_8bit':
png_decoding.c:134:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_grayscale_16bit':
png_decoding.c:146:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_grayscale_alpha_8bit':
png_decoding.c:158:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_grayscale_alpha_16bit':
png_decoding.c:170:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_truecolor_8bit':
png_decoding.c:210:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_truecolor_16bit':
png_decoding.c:222:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_truecolor_alpha_8bit':
png_decoding.c:234:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_scanline_truecolor_alpha_16bit':
png_decoding.c:246:3: warning: ISO C90 forbids mixed declarations and code
png_decoding.c: In function 'oily_png_decode_png_image_pass':
png_decoding.c:336:5: warning: ISO C90 forbids mixed declarations and code
png_decoding.c:340:5: warning: ISO C90 forbids mixed declarations and code
png_decoding.c:346:5: warning: ISO C90 forbids mixed declarations and code
png_decoding.c:351:5: warning: ISO C90 forbids mixed declarations and code
compiling png_encoding.c
png_encoding.c: In function 'oily_png_encode_filter_up':
png_encoding.c:15:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_scanline_grayscale_1bit':
png_encoding.c:53:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_scanline_grayscale_2bit':
png_encoding.c:72:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_scanline_grayscale_4bit':
png_encoding.c:86:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_scanline_grayscale_8bit':
png_encoding.c:98:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_scanline_grayscale_alpha_8bit':
png_encoding.c:109:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_scanline_truecolor_8bit':
png_encoding.c:161:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_scanline_truecolor_alpha_8bit':
png_encoding.c:172:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c: In function 'oily_png_encode_png_image_pass_to_stream':
png_encoding.c:247:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c:257:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c:262:3: warning: ISO C90 forbids mixed declarations and code
png_encoding.c:275:3: warning: ISO C90 forbids mixed declarations and code
compiling resampling.c
resampling.c: In function 'oily_png_generate_steps_residues':
resampling.c:23:3: warning: ISO C90 forbids mixed declarations and code
resampling.c: In function 'oily_png_canvas_steps':
resampling.c:48:3: warning: ISO C90 forbids mixed declarations and code
resampling.c:57:3: warning: ISO C90 forbids mixed declarations and code
resampling.c: In function 'oily_png_canvas_steps_residues':
resampling.c:75:3: warning: ISO C90 forbids mixed declarations and code
resampling.c:89:3: warning: ISO C90 forbids mixed declarations and code
resampling.c:107:3: warning: ISO C90 forbids mixed declarations and code
resampling.c: In function 'oily_png_canvas_resample_nearest_neighbor_bang':
resampling.c:130:3: warning: ISO C90 forbids mixed declarations and code
resampling.c:136:7: warning: ISO C90 forbids mixed declarations and code
resampling.c: In function 'oily_png_canvas_resample_bilinear_bang':
resampling.c:173:3: warning: ISO C90 forbids mixed declarations and code
linking shared-object oily_png/oily_png.so

make  install
/usr/bin/install -c -m 0755 oily_png.so c:/Ruby193/lib/ruby/gems/1.9.1/gems/oily_png-1.1.2/ext/oily_png/.gem.20150430-4216-fq2e2a/oily_png
installing default oily_png libraries

但我只能看到警告,其中 none 给我敲响了警钟。

我正在使用 Windows。具体来说,Windows 8.1 Enterprise x64

经过一段时间的谷歌搜索,我找到了this issue on the rubygems Github

建议的解决方案之一是将 ruby​​gems 降级到 2.3(我安装了 2.4)

gem update --system 2.3.0

这解决了我的问题,我的 bundle 成功完成。