読者です 読者をやめる 読者になる 読者になる

せかいや

いまいるここを、おもしろく http://sekai-in-the-box.appspot.com/

【Ruby】【Rails】gem install railsがコケる

 
■topic summary
Error installing rails X(



はまった。。。

gem install rails

がなぜかコケる。
 
■ログ

$ gem install rails
Fetching: atomic-1.1.14.gem (100%)
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.

    c:/Ruby200/bin/ruby.exe extconf.rb
*** 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:/Ruby200/bin/ruby
        --with-atomic_reference-dir
        --without-atomic_reference-dir
        --with-atomic_reference-include
        --without-atomic_reference-include=${atomic_reference-dir}/include
        --with-atomic_reference-lib
        --without-atomic_reference-lib=${atomic_reference-dir}/
c:/Ruby200/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from c:/Ruby200/lib/ruby/2.0.0/mkmf.rb:515:in `try_link0'
        from c:/Ruby200/lib/ruby/2.0.0/mkmf.rb:813:in `try_run'
        from extconf.rb:26:in `<main>'


Gem files will remain installed in c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/gem_make.out

mkmf.logを見ても、エラーは載っていない。

C:\Ruby200\lib\ruby\gems\2.0.0\gems\atomic-1.1.14\ext\mkmf.log 

 

解決方法

ここに書いてある通り、
http://stackoverflow.com/questions/18777079/cant-install-atomic-ruby-atomic-gem-in-rails-4-0

 
atomic-1.1.14 のインストールでこけているようなので、
atomicだけ単体インストールする。

gem install atomic -V

■ログ
当然エラーになる

$ gem install atomic -V
HEAD https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
Installing gem atomic-1.1.14
Temporarily enhancing PATH to include DevKit...
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/test/test_atomic.rb

 
ログを見る。

 c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/

 

In file included from c:/Ruby200/include/ruby-2.0.0/ruby.h:33:0,
                 from conftest.c:1:
c:/Ruby200/include/ruby-2.0.0/ruby/ruby.h:125:14: error: size of array 'ruby_check_sizeof_voidp' is negative
In file included from c:/Ruby200/include/ruby-2.0.0/ruby.h:33:0,
                 from conftest.c:1:
c:/Ruby200/include/ruby-2.0.0/ruby/ruby.h: In function 'rb_float_value':

ここが怪しい。

Why does installing Ruby on Rails generate error "size of array 'ruby_check_sizeof_voidp' is negative? - Stack Overflow
 

原因

Rubyが32ビット用、
DevKitが64ビット用だったのがエラーの原因

 
orz

ここを参考にDevKitを再インストール
おもっことをまったりと Devkit削除

$ ruby dk.rb  install
[INFO] Skipping existing gem override for 'C:/Heroku/ruby-1.9.2'
[WARN] Skipping existing DevKit helper library for 'C:/Heroku/ruby-1.9.2'
[INFO] Updating existing gem override for 'C:/Ruby200'
[INFO] Installing 'C:/Ruby200/lib/ruby/site_ruby/devkit.rb'

よし、再インストールされた。


 

mkmf.log は閉じましょう

 
再度インストールするも、エラー。
なんでやねん。

$ gem install atomic -V --platform=ruby
HEAD https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
GET https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
200 OK
Installing gem atomic-1.1.14
Temporarily enhancing PATH to include DevKit...
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/test/test_atomic.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/extconf.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/.gitignore
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/.travis.yml
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/LICENSE
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/README.md
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/Rakefile
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/atomic.gemspec
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/atomic_example.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/bench_atomic.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/bench_atomic_1.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/graph_atomic_bench.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/AtomicReferenceService.java
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/atomic_reference.c
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/org/jruby/ext/atomic/AtomicReferenceLibrary.java
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/concurrent_update_error.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/delegated_update.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/direct_update.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/fallback.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/jruby.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/numeric_cas_wrapper.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/rbx.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/ruby.rb
Building native extensions.  This could take a while...
c:/Ruby200/bin/ruby.exe extconf.rb
*** 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.
C:\Ruby200\lib\ruby\gems\2.0.0\gems\atomic-1.1.14\ext

を見ると、更新されるべきログファイル
mkmf.log
が更新されていない。

メモ帳で開いていたから。


もしやと思って、閉じて、再インストール。

成功しました。

orz

$ gem install atomic -V --platform=ruby
HEAD https://rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
Installing gem atomic-1.1.14
Temporarily enhancing PATH to include DevKit...
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/test/test_atomic.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/extconf.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/.gitignore
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/.travis.yml
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/LICENSE
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/README.md
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/Rakefile
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/atomic.gemspec
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/atomic_example.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/bench_atomic.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/bench_atomic_1.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/examples/graph_atomic_bench.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/AtomicReferenceService.java
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/atomic_reference.c
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/org/jruby/ext/atomic/AtomicReferenceLibrary.java
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/concurrent_update_error.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/delegated_update.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/direct_update.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/fallback.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/jruby.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/numeric_cas_wrapper.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/rbx.rb
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/lib/atomic/ruby.rb
Building native extensions.  This could take a while...
c:/Ruby200/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR="
generating atomic_reference-i386-mingw32.def
compiling atomic_reference.c
linking shared-object atomic_reference.so
make "DESTDIR=" install
/usr/bin/install -c -m 0755 atomic_reference.so ./.gem.20131201-13740-8jc703
installing default atomic_reference libraries

Successfully installed atomic-1.1.14
Parsing documentation for atomic-1.1.14
Parsing sources...
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/atomic_reference.so, skipping

Installing ri documentation for atomic-1.1.14
1 gem installed

本題も解決

$ gem install rails
Installing ri documentation for rails-4.0.1
14 gems installed

 
長かったorz