gem install thinすると下記のようなエラー。
C:\Users\kyashiro>gem install thin
Building native extensions. This could take a while...
ERROR: Error installing thin:
ERROR: Failed to build gem native extension.
C:/ruby/bin/ruby.exe extconf.rb
checking for main() in c.lib... no
creating Makefile
nmake
'nmake' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/thin-1.5.0 for
inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/thin-1.5.0/ext/thin_parser/gem_
make.out
これ前にもあったなと思って手元のメモを検索してみたら、rcovをインストールしたときにも出てたんでそのときの方法を一応書いときます。
ちなみに環境はWindows 7 64bitでRubyのバージョンは1.8.7。
Visual Studioのコマンドプロントからだとnmakeへのパスが通ってるようなのでVisual Studio 2010のコマンドプロントから再度gem install thinすると今度は下記のようなエラー。
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>gem install thin
Building native extensions. This could take a while...
ERROR: Error installing thin:
ERROR: Failed to build gem native extension.
C:/ruby/bin/ruby.exe extconf.rb
checking for main() in c.lib... no
creating Makefile
nmake
Microsoft(R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
C:\ruby\bin\ruby -e "puts 'EXPORTS', 'Init_thin_parser'" > thin_parser-
i386-mswin32.def
cl -nologo -I. -I. -IC:/ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b
2xg- -G6 -c -Tcparser.c
cl : コマンド ライン warning D9035 : オプション 'Og-' の使用は現在推奨されていま
せん。今後のバージョンからは削除されます。
cl : コマンド ライン warning D9002 : 不明なオプション '-G6' を無視します
parser.c
cl -nologo -I. -I. -IC:/ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b
2xg- -G6 -c -Tcthin.c
cl : コマンド ライン warning D9035 : オプション 'Og-' の使用は現在推奨されていま
せん。今後のバージョンからは削除されます。
cl : コマンド ライン warning D9002 : 不明なオプション '-G6' を無視します
thin.c
c:\ruby\lib\ruby\1.8\i386-mswin32\config.h(2) : fatal error C1189: #error : MSC
version unmatch: _MSC_VER: 1200 is expected.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : リターン コード '0x2'
Stop.
Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/thin-1.5.0 for
inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/thin-1.5.0/ext/thin_parser/gem_
make.out
config.hを覗いてみると
#if _MSC_VER != 1200
#error MSC version unmatch: _MSC_VER: 1200 is expected.
#endif
_MSC_VERっていうのはcl.exe(VC++のコンパイラ)のバージョンらしい。
Wikipediaによると2010の_MSC_VERは1600とのこと。ちなみに1200はVisual C++ 6.0とのことですね。なので
#if _MSC_VER < 1200
とか
#if _MSC_VER != 1600
とか編集すればいけます。Windows面倒いっすね。(嫌いじゃないけど)