繁体   English   中英

gem install rails在nio4r Windows7 ruby​​ 2.3上失败

[英]gem install rails fails on nio4r windows7 ruby 2.3

尝试在Windows 7机器上安装滑轨:

红宝石-v 2.5.2

红宝石2.3.3p222(2016-11-21修订版56859)[i386-mingw32]

已安装的红宝石

已安装的devkit

ruby dk.rb init
ruby dk.rb install 

然后> gem install rails(我将得到以下错误)

无法构建gem本机扩展 Windows 7

C:\>gem install rails
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1/ext/nio4r
C:/Ruby23/bin/ruby.exe -r ./siteconf20161215-7288-1jiw6zb.rb extconf.rb
checking for unistd.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby23/bin/$(RUBY_BASE_NAME)
C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generat
e an executable file. (RuntimeError)
You have to install development tools first.
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpo
ne'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
        from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
        from extconf.rb:3:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
 be found here:

  C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r-1.2.1/mkmf.lo
g

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.
1 for inspection.
Results logged to C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio
4r-1.2.1/gem_make.out

C:\>ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]

C:\>

>

如果有人在Windows上遇到同样的问题! 这是我为最终安装Rails(和nio4r)所做的工作:

将Ruby 2.3.3降级到Ruby 2.2.6

安装32位版本的DevKit (DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe)

cd devkit 

ruby dk.rb init

ruby dk.rb review 

ruby dk.rb install 

cd \

gem install rails 

哇!

对于同一红宝石版本(2.3.3),降级到32位版本的DevKit(DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe)为我解决了此问题。 我不必将Ruby降级到2.2.6。

感谢您指出正确的方向!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM