No Bugs, No Life

読んだ本や、プログラミング、システム開発等のねたを中心に。文章を書く練習なので少し硬派に書くつもりだけど、どうなることやら。

Ruby2.0の導入@Windows7

実はMementoWeaver開発記の続き
先日のエントリ(MWの近況と小ネタ - No Bugs, No Life)でも少し触れたが、現存するメメントをMWで利用可能な形で移行する必要がある。
で、移行プログラムを作成する必要があるのだが、正規表現とかガシガシ使うことになるので、流石にJavaではなくRubyを使いたいなと。
一応、今のPCにもRuby1.9.3は入っているが、あまり活用できていないし、頭の中はまだRuby1.8系列のままだしと言うことで、思い切って(?)Ruby2.0を常用するためにセットアップする。

Ruby2.0の導入

今回は遂にRuby2.0なので、気分も新たにmingwrubyであるRubyInstaller for Windows(旧称:One-click Ruby Installer)を試してみることにする。

RubyInstaller for Windowsのダウンロードとインストール

RubyInstaller for Windowsのダウンロードページ(Downloads)よりRuby 2.0.0-p0(ファイル名:rubyinstaller-2.0.0-p0.exe)をダウンロードしてインストーラを実行。
なお、rubyは32bit版を選択した。後述するが、64bit版ではnative拡張をgemで作成できなかったので。
既存アプリで1.9.3環境を使用してVisualuRubyを動かしているので、競合しないようにPATHを設定しない積もりだったけど、DevKitとかでPATHを設定することが求められていそうだったので、一旦ユーザー環境変数としてPATHを設定するようインストーラに伝える。

DevKitのダウンロードとインストール

どうやらgemでnativeライブラリを使用する際にはDevKitが必要らしいので、DownloadsからDevKit-mingw64-32-4.7.2-20130224-1151-sfx.exeをダウンロードする。
ダウンロード完了後、Development Kit · oneclick/rubyinstaller Wiki · GitHubの記述に従って、アーカイブを展開(C:\home\softwares\DevKit4.7.2)して、インストールヘルパスクリプトを実行する。

ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

C:\Users\kazyury>cd C:\home\softwares\Devkit4.7.2

C:\home\softwares\Devkit4.7.2>dir
 ドライブ C のボリューム ラベルがありません。
 ボリューム シリアル番号は A64B-0D63 です

 C:\home\softwares\Devkit4.7.2 のディレクトリ

2013/04/29  19:55    <DIR>          .
2013/04/29  19:55    <DIR>          ..
2013/02/24  21:55    <DIR>          bin
2013/02/24  23:51               297 devkitvars.bat
2013/02/24  23:51               361 devkitvars.ps1
2013/02/24  23:51            10,232 dk.rb
2013/02/24  21:55    <DIR>          etc
2010/02/06  09:39    <DIR>          include
2013/02/24  21:55    <DIR>          lib
2009/07/12  03:34             2,238 m.ico
2013/02/24  21:55    <DIR>          mingw
2010/09/29  08:48             7,167 msys.bat
2009/07/12  03:34            37,758 msys.ico
2010/03/18  07:06    <DIR>          postinstall
2010/04/17  12:53    <DIR>          sbin
2013/02/24  21:55    <DIR>          share
               6 個のファイル              58,053 バイト
              10 個のディレクトリ  171,258,908,672 バイトの空き領域

C:\home\softwares\Devkit4.7.2>ruby dk.rb init
[INFO] found RubyInstaller v2.0.0 at C:/Ruby200

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:\home\softwares\Devkit4.7.2>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby200'
[INFO] Installing 'C:/Ruby200/lib/ruby/site_ruby/devkit.rb'

C:\home\softwares\Devkit4.7.2>gem install json --platform=ruby
Fetching: json-1.7.7.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed json-1.7.7
Parsing documentation for json-1.7.7
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/generator.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/parser.so, skipping
Installing ri documentation for json-1.7.7
Done installing documentation for json (2 sec).
1 gem installed

C:\home\softwares\Devkit4.7.2>ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"
[42]

C:\home\softwares\Devkit4.7.2>

okの様子。

GUIツールキットの選択

RubyInstallerの配布物を見てみるとVisualuRubyが無い。artonさんのところのRuby-2.0.0-p0 Microsoft Installer Package(2013-02-24)も同様...。
ruby界隈ではGUIツールキットは人気が無いなぁ。ざっと調べてみたところを整理する。

名称 公式サイト
ruby-gnome2 FrontPage - Ruby-GNOME2 Project Website
Visual Ruby Visual Ruby -- GUI with Ruby and Glade
green_shoes ashbb/green_shoes · GitHub
shoes Shoes! The easiest little GUI toolkit, for Ruby.
VisualuRuby計画(仮称) VisualuRuby計画(仮称)

上記のうち、Visual Rubyとshoesは専用の開発環境的なモノが導入されるようなので、可搬性が悪そうなので今回は見送る。
本当は慣れてるVisualuRubyを使いたかったんだけど、ASRにも含まれなくなったということはきっと動かないのだろうと予想されるのでスキップ(もう開発はしていないのかな...)。
ruby-gnome2とgreen_shoesの選択となったが、今時っぽいgreen_shoesを試してみることにする。
ruby-gnome2ではWindowsはおまけ的に扱われているような気もすることも一因。
green_shoesも内部的にはGTK+とかを使っているので、green_shoesをセットアップすればruby-gnome2も使えるだろうと。

green_shoesのインストール

Building Green Shoes on Windows 7 · ashbb/green_shoes Wiki · GitHubに、RubyInstallerを入れたら後はgem install green_shoesでOKさ!!!と書かれていた(意訳)ので実行する。

C:\home\softwares\Devkit4.7.2>gem install green_shoes
Fetching: pkg-config-1.1.4.gem (100%)
Successfully installed pkg-config-1.1.4
Fetching: glib2-2.0.0-x86-mingw32.gem (100%)
Successfully installed glib2-2.0.0-x86-mingw32
Fetching: atk-2.0.0-x86-mingw32.gem (100%)
Successfully installed atk-2.0.0-x86-mingw32
Fetching: cairo-1.12.4-x86-mingw32.gem (100%)
Successfully installed cairo-1.12.4-x86-mingw32
Fetching: pango-2.0.0-x86-mingw32.gem (100%)
Successfully installed pango-2.0.0-x86-mingw32
Fetching: gdk_pixbuf2-2.0.0-x86-mingw32.gem (100%)
Successfully installed gdk_pixbuf2-2.0.0-x86-mingw32
Fetching: gtk2-2.0.0-x86-mingw32.gem (100%)
Successfully installed gtk2-2.0.0-x86-mingw32
Fetching: green_shoes-1.1.373.gem (100%)
Successfully installed green_shoes-1.1.373
Parsing documentation for pkg-config-1.1.4
Installing ri documentation for pkg-config-1.1.4
Parsing documentation for glib2-2.0.0-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/1.9/glib2.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/2.0/glib2.so, skipping
Installing ri documentation for glib2-2.0.0-x86-mingw32
Parsing documentation for atk-2.0.0-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/1.9/atk.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/2.0/atk.so, skipping
Installing ri documentation for atk-2.0.0-x86-mingw32
Parsing documentation for cairo-1.12.4-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/1.9/cairo.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/2.0/cairo.so, skipping
Installing ri documentation for cairo-1.12.4-x86-mingw32
Parsing documentation for pango-2.0.0-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/1.9/pango.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/2.0/pango.so, skipping
Installing ri documentation for pango-2.0.0-x86-mingw32
Parsing documentation for gdk_pixbuf2-2.0.0-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/1.9/gdk_pixbuf2.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/2.0/gdk_pixbuf2.so, skipping
Installing ri documentation for gdk_pixbuf2-2.0.0-x86-mingw32
Parsing documentation for gtk2-2.0.0-x86-mingw32
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/1.9/gtk2.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/2.0/gtk2.so, skipping
Installing ri documentation for gtk2-2.0.0-x86-mingw32
Parsing documentation for green_shoes-1.1.373
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/ext/bloops/bloops.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/ext/bloops/libportaudio-2.dll, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/ext/chipmunk/chipmunk.so, skipping
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/ext/hpricot/hpricot_scan.so, skipping
unable to convert "\xA9" from ASCII-8BIT to UTF-8 for lib/shoes/minitar.rb, skipping
Installing ri documentation for green_shoes-1.1.373
Done installing documentation for pkg-config, glib2, atk, cairo, pango, gdk_pixbuf2, gtk2, green_shoes (16 sec).
8 gems installed

C:\home\softwares\Devkit4.7.2>

問題なく入ったっぽい。

green_shoesを試してみる

こんなコードを書いて試してみる。

require 'green_shoes'

Shoes.app do
  para 'welcome to shoes'
end

f:id:kazyury:20130429203116p:plain
できた。が、、、これだけでSEGVってる...。

green_shoes_test.rb: [BUG] Segmentation fault
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0002 E:0007bc TOP    [FINISH]


-- C level backtrace information -------------------------------------------
C:\windows\SysWOW64\ntdll.dll(ZwWaitForSingleObject+0x15) [0x77BFF8B1]
C:\windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x75801194]
C:\windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x75801148]
C:\Ruby200\bin\msvcrt-ruby200.dll(rb_vm_bugreport+0xa7) [0x668F5927]
C:\Ruby200\bin\msvcrt-ruby200.dll(rb_name_err_mesg_new+0x69d) [0x667BD97D]
C:\Ruby200\bin\msvcrt-ruby200.dll(rb_bug+0x2e) [0x667BE77E]
C:\Ruby200\bin\msvcrt-ruby200.dll(rb_check_safe_str+0x17c) [0x6687D0FC]
 [0x00401866]
C:\windows\SysWOW64\ntdll.dll(RtlKnownExceptionFilter+0xb7) [0x77C574DF]

-- Other runtime information -----------------------------------------------

* Loaded script: green_shoes_test.rb

* Loaded features:

    0 enumerator.so
    1 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/enc/encdb.so
    2 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/enc/windows_31j.so
    3 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/enc/trans/transdb.so
    4 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/rbconfig.rb
    5 C:/Ruby200/lib/ruby/2.0.0/rubygems/compatibility.rb
    6 C:/Ruby200/lib/ruby/2.0.0/rubygems/defaults.rb
    7 C:/Ruby200/lib/ruby/2.0.0/rubygems/deprecate.rb
    8 C:/Ruby200/lib/ruby/2.0.0/rubygems/errors.rb
    9 C:/Ruby200/lib/ruby/2.0.0/rubygems/version.rb
   10 C:/Ruby200/lib/ruby/2.0.0/rubygems/requirement.rb
   11 C:/Ruby200/lib/ruby/2.0.0/rubygems/platform.rb
   12 C:/Ruby200/lib/ruby/2.0.0/rubygems/specification.rb
   13 C:/Ruby200/lib/ruby/2.0.0/rubygems/exceptions.rb
   14 C:/Ruby200/lib/ruby/2.0.0/rubygems/defaults/operating_system.rb
   15 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/enc/utf_16le.so
   16 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/enc/trans/utf_16_32.so
   17 C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb
   18 C:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb
   19 C:/Ruby200/lib/ruby/2.0.0/rubygems.rb
   20 C:/Ruby200/lib/ruby/2.0.0/rubygems/path_support.rb
   21 C:/Ruby200/lib/ruby/2.0.0/rubygems/dependency.rb
   22 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/etc.so
   23 C:/Ruby200/lib/ruby/2.0.0/fileutils.rb
   24 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/enc/trans/japanese_sjis.so
   25 C:/Ruby200/lib/ruby/2.0.0/tmpdir.rb
   26 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/pathname.so
   27 C:/Ruby200/lib/ruby/2.0.0/pathname.rb
   28 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/color.rb
   29 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/paper.rb
   30 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/2.0/cairo.so
   31 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/constants.rb
   32 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/point.rb
   33 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/colors.rb
   34 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/papers.rb
   35 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/context/rectangle.rb
   36 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/context/triangle.rb
   37 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/context/circle.rb
   38 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/context/path.rb
   39 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/context/blur.rb
   40 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/context/color.rb
   41 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/context.rb
   42 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/device.rb
   43 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/surface.rb
   44 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/pattern.rb
   45 C:/Ruby200/lib/ruby/2.0.0/forwardable.rb
   46 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo/path.rb
   47 C:/Ruby200/lib/ruby/gems/2.0.0/gems/cairo-1.12.4-x86-mingw32/lib/cairo.rb
   48 C:/Ruby200/lib/ruby/2.0.0/English.rb
   49 C:/Ruby200/lib/ruby/2.0.0/thread.rb
   50 C:/Ruby200/lib/ruby/gems/2.0.0/gems/glib2-2.0.0-x86-mingw32/lib/glib2/deprecatable.rb
   51 C:/Ruby200/lib/ruby/gems/2.0.0/gems/glib2-2.0.0-x86-mingw32/lib/2.0/glib2.so
   52 C:/Ruby200/lib/ruby/gems/2.0.0/gems/glib2-2.0.0-x86-mingw32/lib/glib2.rb
   53 C:/Ruby200/lib/ruby/gems/2.0.0/gems/pango-2.0.0-x86-mingw32/lib/2.0/pango.so
   54 C:/Ruby200/lib/ruby/gems/2.0.0/gems/pango-2.0.0-x86-mingw32/lib/pango.rb
   55 C:/Ruby200/lib/ruby/gems/2.0.0/gems/gdk_pixbuf2-2.0.0-x86-mingw32/lib/2.0/gdk_pixbuf2.so
   56 C:/Ruby200/lib/ruby/gems/2.0.0/gems/gdk_pixbuf2-2.0.0-x86-mingw32/lib/gdk_pixbuf2.rb
   57 C:/Ruby200/lib/ruby/gems/2.0.0/gems/atk-2.0.0-x86-mingw32/lib/2.0/atk.so
   58 C:/Ruby200/lib/ruby/gems/2.0.0/gems/atk-2.0.0-x86-mingw32/lib/atk.rb
   59 C:/Ruby200/lib/ruby/gems/2.0.0/gems/gtk2-2.0.0-x86-mingw32/lib/2.0/gtk2.so
   60 C:/Ruby200/lib/ruby/gems/2.0.0/gems/gtk2-2.0.0-x86-mingw32/lib/gtk2/base.rb
   61 C:/Ruby200/lib/ruby/gems/2.0.0/gems/gtk2-2.0.0-x86-mingw32/lib/gtk2.rb
   62 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/ruby.rb
   63 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/helper_methods.rb
   64 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/colors.rb
   65 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/basic.rb
   66 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/main.rb
   67 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/app.rb
   68 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/anim.rb
   69 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/slot.rb
   70 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/text.rb
   71 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/mask.rb
   72 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/widget.rb
   73 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/url.rb
   74 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/style.rb
   75 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/projector.rb
   76 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/download.rb
   77 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/manual.rb
   78 C:/Ruby200/lib/ruby/2.0.0/find.rb
   79 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/minitar.rb
   80 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/digest.so
   81 C:/Ruby200/lib/ruby/2.0.0/digest.rb
   82 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/digest/md5.so
   83 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/zlib.so
   84 C:/Ruby200/lib/ruby/2.0.0/psych/syntax_error.rb
   85 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/psych.so
   86 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/stringio.so
   87 C:/Ruby200/lib/ruby/2.0.0/psych/nodes/node.rb
   88 C:/Ruby200/lib/ruby/2.0.0/psych/nodes/stream.rb
   89 C:/Ruby200/lib/ruby/2.0.0/psych/nodes/document.rb
   90 C:/Ruby200/lib/ruby/2.0.0/psych/nodes/sequence.rb
   91 C:/Ruby200/lib/ruby/2.0.0/psych/nodes/scalar.rb
   92 C:/Ruby200/lib/ruby/2.0.0/psych/nodes/mapping.rb
   93 C:/Ruby200/lib/ruby/2.0.0/psych/nodes/alias.rb
   94 C:/Ruby200/lib/ruby/2.0.0/psych/nodes.rb
   95 C:/Ruby200/lib/ruby/2.0.0/psych/streaming.rb
   96 C:/Ruby200/lib/ruby/2.0.0/psych/visitors/visitor.rb
   97 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/strscan.so
   98 C:/Ruby200/lib/ruby/2.0.0/psych/scalar_scanner.rb
   99 C:/Ruby200/lib/ruby/2.0.0/psych/visitors/to_ruby.rb
  100 C:/Ruby200/lib/ruby/2.0.0/psych/visitors/emitter.rb
  101 C:/Ruby200/lib/ruby/2.0.0/psych/visitors/yaml_tree.rb
  102 C:/Ruby200/lib/ruby/2.0.0/psych/json/ruby_events.rb
  103 C:/Ruby200/lib/ruby/2.0.0/psych/visitors/json_tree.rb
  104 C:/Ruby200/lib/ruby/2.0.0/psych/visitors/depth_first.rb
  105 C:/Ruby200/lib/ruby/2.0.0/psych/visitors.rb
  106 C:/Ruby200/lib/ruby/2.0.0/psych/handler.rb
  107 C:/Ruby200/lib/ruby/2.0.0/psych/tree_builder.rb
  108 C:/Ruby200/lib/ruby/2.0.0/psych/parser.rb
  109 C:/Ruby200/lib/ruby/2.0.0/psych/omap.rb
  110 C:/Ruby200/lib/ruby/2.0.0/psych/set.rb
  111 C:/Ruby200/lib/ruby/2.0.0/psych/coder.rb
  112 C:/Ruby200/lib/ruby/2.0.0/psych/core_ext.rb
  113 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/date_core.so
  114 C:/Ruby200/lib/ruby/2.0.0/date/format.rb
  115 C:/Ruby200/lib/ruby/2.0.0/date.rb
  116 C:/Ruby200/lib/ruby/2.0.0/psych/deprecated.rb
  117 C:/Ruby200/lib/ruby/2.0.0/psych/stream.rb
  118 C:/Ruby200/lib/ruby/2.0.0/psych/json/yaml_events.rb
  119 C:/Ruby200/lib/ruby/2.0.0/psych/json/tree_builder.rb
  120 C:/Ruby200/lib/ruby/2.0.0/psych/json/stream.rb
  121 C:/Ruby200/lib/ruby/2.0.0/psych/handlers/document_stream.rb
  122 C:/Ruby200/lib/ruby/2.0.0/psych.rb
  123 C:/Ruby200/lib/ruby/2.0.0/yaml.rb
  124 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/enc/trans/single_byte.so
  125 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/shoes/shy.rb
  126 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/plugins/systray.rb
  127 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/plugins/thread.rb
  128 C:/Ruby200/lib/ruby/2.0.0/i386-mingw32/socket.so
  129 C:/Ruby200/lib/ruby/2.0.0/socket.rb
  130 C:/Ruby200/lib/ruby/2.0.0/timeout.rb
  131 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/plugins/httpd.rb
  132 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/plugins/treeview.rb
  133 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/plugins/code_box.rb
  134 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/plugins/video.rb
  135 C:/Ruby200/lib/ruby/gems/2.0.0/gems/green_shoes-1.1.373/lib/green_shoes.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:\Users\kazyury\devel\ruby20>

Librarianは最も我が家で使われているアプリだけどこのままではruby2.0対応は先が遠いな...。
ruby2.0系が安定するまでは現在使用している1.9.3のVisualuRuby版でいかなくてはダメだな。

ruby-gnome2版のテスト

gtk2-tut-helloworld - Ruby-GNOME2 Project Websiteのサンプルでruby-gnome2が動くかを一応確認したが問題なさそう(こちらはSEGVったりしていない)

require 'gtk2'

button = Gtk::Button.new("Hello World")
button.signal_connect("clicked") {
  puts "Hello World"
}

window = Gtk::Window.new
window.signal_connect("delete_event") {
  puts "delete event occurred"
  #true
  false
}

window.signal_connect("destroy") {
  puts "destroy event occurred"
  Gtk.main_quit
}

window.border_width = 10
window.add(button)
window.show_all

Gtk.main

f:id:kazyury:20130429215420p:plain
最悪の場合、VisualuRubyをruby-gnome2(というべきなのか、ruby/gtk2と呼ぶべきか)で書き直せばいいかな。



おまけ:64bit版rubyのgemインストール失敗ログ

一応、何かの役に立つかもしれないので記録に残しておく。

green_shoesのインストール(ruby/devkitともに64bit版)

上記の手順で32bit版なら問題なかったのだが、64bit版のrubyを用いるとextconf.rbが失敗してしまい、導入することが出来ない。以下はそのときのログ。

C:\home\softwares\DevKit4.7.2>gem install green_shoes
Fetching: pkg-config-1.1.4.gem (100%)
Successfully installed pkg-config-1.1.4
Fetching: glib2-2.0.0.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing green_shoes:
        ERROR: Failed to build gem native extension.

    C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for -Wall option to compiler... yes
checking for -Waggregate-return option to compiler... yes
checking for -Wcast-align option to compiler... yes
checking for -Wextra option to compiler... yes
checking for -Wformat=2 option to compiler... yes
checking for -Winit-self option to compiler... yes
checking for -Wlarger-than-65500 option to compiler... yes
checking for -Wmissing-declarations option to compiler... yes
checking for -Wmissing-format-attribute option to compiler... yes
checking for -Wmissing-include-dirs option to compiler... yes
checking for -Wmissing-noreturn option to compiler... yes
checking for -Wmissing-prototypes option to compiler... yes
checking for -Wnested-externs option to compiler... yes
checking for -Wold-style-definition option to compiler... yes
checking for -Wpacked option to compiler... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler... yes
checking for -Wpointer-arith option to compiler... yes
checking for -Wswitch-default option to compiler... yes
checking for -Wswitch-enum option to compiler... yes
checking for -Wundef option to compiler... yes
checking for -Wunsafe-loop-optimizations option to compiler... yes
checking for -Wwrite-strings option to compiler... yes
checking for rb_define_alloc_func() in ruby.h... yes
checking for rb_block_proc() in ruby.h... yes
checking for new allocation framework... yes
checking for attribute assignment... no
checking for Win32 OS... yes
checking for gobject-2.0... no
checking for brew... no
checking for port... no
*** 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-x64/bin/ruby
        --with-pkg-config
        --without-pkg-config
        --with-override-variables
        --without-override-variables


Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/glib2-2.0.0 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/glib2-2.0.0/ext/glib2/gem_make.out

因みにmkmf.logは以下のような感じ(抜粋)

"x86_64-w64-mingw32-gcc -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -IC:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/x64-msvcrt  -IC:/Ruby200-x64/lib/ruby/vendor_ruby/2.0.0/x64-msvcrt  -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wall -Waggregate-return -Wcast-align -Wextra -Wformat=2 -Winit-self -Wlarger-than-65500 -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wp,-D_FORTIFY_SOURCE=2 -Wpointer-arith -Wswitch-default -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings   -c conftest.c"
conftest.c:6:18: fatal error: node.h: No such file or directory

compilation terminated.

checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: #include "ruby.h"
6: #include "node.h"
7: int node_attrasgn = (int)NODE_ATTRASGN;
/* end */

どうやらnode.hが見つからないって文句を垂れている様子だが、一寸手に負えなさそうなので暫く様子見(x64ではglib2-2.0.0.gemをfetchしようとしていて、x86ではglib2-2.0.0-x86-mingw32.gemなのでその違いなのかな?)。