soukouki’s diary

この記事が、誰かの役に、なればいい。

raccをインストールしてみた。

osはwindowsです。

gem install racc

Fetching: racc-1.4.14.gem (100%)
ERROR:  Error installing racc:
        The 'racc' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

え、エラー・・・

どうやらDEVELOPMENT KIT が必要と。

ダウンロードして展開。そしてパスの通ったところに放り込む。

gem install racc

Building native extensions.  This could take a while...
ERROR:  Error installing racc:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/racc-1.4.14/ext/racc
C:/Ruby23-x64/bin/ruby.exe -r ./siteconf20160524-9188-xy7bgg.rb extconf.rb
checking for rb_ary_subseq()... *** 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-x64/bin/$(RUBY_BASE_NAME)
C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable
 file. (RuntimeError)
You have to install development tools first.
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:541:in `try_link0'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:320:in `open'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
        from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
        from extconf.rb:5:in `<main>'

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

  C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/racc-1.4.14/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/racc-1.4.14 for inspectio
n.
Results logged to C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/racc-1.4.14/gem_ma
ke.out

またか。

2回やっても同じエラー。

DEVELOPMENT KIT のセットアップ方法 - 君の瞳はまるでルビー - Ruby 関連まとめサイト

この後さらに何かやるのか。

DEVELOPMENT KITと同じフォルダに移動

ruby dk.rb init

[INFO] found RubyInstaller v2.3.0 at C:/Ruby23-x64

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
C:\MinGW> ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby23-x64'
[INFO] Installing 'C:/Ruby23-x64/lib/ruby/site_ruby/devkit.rb'

ruby dk.rb install

[INFO] Updating convenience notice gem override for 'C:/Ruby23-x64'
[INFO] Installing 'C:/Ruby23-x64/lib/ruby/site_ruby/devkit.rb'

おっ!

gem install racc

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed racc-1.4.14
Parsing documentation for racc-1.4.14
Installing ri documentation for racc-1.4.14
Done installing documentation for racc after 10 seconds
1 gem installed

で、出来た。

soukouki.hatenablog.jp


racc version 1.4.14
gem --version 2.5.1
ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
Microsoft Windows NT 10.0.10586.0