mieki256's diary



2018/02/14(水) [n年前の日記]

#1 [ruby][dxruby] DXOpalを試用してみようと思ったらインストールでハマった

DXOpal という、Rubyのソースをブラウザ上で動かせるゲームライブラリがあるのだけれど。

_DXOpal demo
_Rubyist Magazine - Rubyで始めるゲームプログラミング - DXOpal編 -

_以前少し試用した のだけど、現行版はテンプレートの出力ができたり、サーバを起動して動作確認できるようになっているようで。スゴイ。これはなんだか便利そう。

ということで、DXOpal を Windows10 x64 + Ruby mingw版の環境でインストールしてみようとしたものの、ちょっとハマった。

結論だけ先に書くと…。

Windows上でインストールできない。 :

Ruby 2.2.6 p 396 mingw版では、DXOpal をインストールしようとしても、以下のようなエラーが表示される。

> ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]

> gem install dxopal
Fetching: sourcemap-0.1.1.gem (100%)
Successfully installed sourcemap-0.1.1
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: opal-0.11.0.gem (100%)
C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:388:in `symlink': symlink() function is unimplemented on this machine (NotImplementedError)
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:388:in `block (2 levels) in extract_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/tar_reader.rb:65:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:365:in `block in extract_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:459:in `block in open_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:456:in `wrap'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:456:in `open_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:364:in `extract_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:345:in `block (2 levels) in extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/tar_reader.rb:65:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:342:in `block in extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/file_source.rb:30:in `open'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/file_source.rb:30:in `with_read_io'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:339:in `extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/installer.rb:772:in `extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/installer.rb:302:in `install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/resolver/specification.rb:97:in `install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/request_set.rb:166:in `block in install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/request_set.rb:156:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/request_set.rb:156:in `install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:205:in `install_gem'

        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:255:in `block in install_gems'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:251:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:251:in `install_gems'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:158:in `execute'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/command.rb:310:in `invoke_with_build_args'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/command_manager.rb:169:in `process_args'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/command_manager.rb:139:in `run'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/gem_runner.rb:55:in `run'
        from C:/Ruby/Ruby22/bin/gem:21:in `<main>'

opal のインストールで失敗してるように見える。これはアレかな。Windows版の Ruby では使えない、というオチかな…。

Ruby 2.3.3 ではどうだろう。

> uru ls
    187mingw32  : ruby 1.8.7 (2013-06-27 patchlevel 374) [i386-mingw32]
    187mswin32  : ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mswin32]
    19          : ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
    200         : ruby 2.0.0p648 (2015-12-16) [i386-mingw32]
    21          : ruby 2.1.9p490 (2016-03-30 revision 54437) [i386-mingw32]
    220mswin32  : ruby 2.2.0p0 (2014-12-25 revision 49005) [i386-mswin32_100]
    23          : ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
    24          : ruby 2.4.3p205 (2017-12-14 revision 61247) [i386-mingw32]
 => system      : ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]

> uru 23
---> now using ruby 2.3.3-p222 tagged as `23`

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

> gem install dxopal
Fetching: sourcemap-0.1.1.gem (100%)
Successfully installed sourcemap-0.1.1
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: ast-2.4.0.gem (100%)
Successfully installed ast-2.4.0
Fetching: parser-2.3.3.1.gem (100%)
Successfully installed parser-2.3.3.1
Fetching: opal-0.11.0.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_file_s_symlink - (./exe, D:/Ruby/Ruby23/lib/ruby/gems/2.3.0/gems/opal-0.11.0/bin)

Ruby 2.3.3 p222 上でもエラーが出るな…。Ruby 2.2.6 と比べたら、まだスルスルと進んでる気配もあるけれど。

ちなみに、uru というのは、Ruby の異なるバージョンを切り替えて使うことができるツール。

_uru - Windows用のRuby環境セレクター | ソフトアンテナブログ
_pikの替わりにuru〜windowsで複数バージョンのrubyを切り替える〜 - Qiita
_Windows7でRubyのバージョン管理!pikの代わりにuruを使う。 - 思い付くまでタイトル未定

他に、pik というツールを使っても、Rubyのバージョンを切り替えることができる。

_Windows7にRubyInstaller+Pikで複数バージョンのRuby環境を整える - ひろうぃんの雑記

さておき。Ruby 2.4.3 ではどうかな。

> uru 24
---> now using ruby 2.4.3-p205 tagged as `24`

> ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [i386-mingw32]

> gem install dxopal
Fetching: sourcemap-0.1.1.gem (100%)
Successfully installed sourcemap-0.1.1
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: ast-2.4.0.gem (100%)
Successfully installed ast-2.4.0
Fetching: parser-2.3.3.1.gem (100%)
Successfully installed parser-2.3.3.1
Fetching: opal-0.11.0.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_file_s_symlink - (./exe, D:/Ruby/Ruby24/lib/ruby/gems/2.4.0/gems/opal-0.11.0/bin)

Ruby 2.3.3 と同様のエラーが出た。

管理者権限でインストールしないといかんらしい。 :

エラーメッセージでググったら以下の記事に遭遇。

_メモ: Sass をWindowsに入れようとしたらgemで怒られたよ - tetsunosukeのnotebook

管理者権限でコマンドプロンプトを開いて、そこで作業すると改善する場合もあるらしい。試してみた。

Ruby 2.2.6 の場合。
> ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]

> gem install dxopal
C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:388:in `symlink': symlink() function is unimplemented on this machine (NotImplementedError)
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:388:in `block (2 levels) in extract_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/tar_reader.rb:65:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:365:in `block in extract_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:459:in `block in open_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:456:in `wrap'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:456:in `open_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:364:in `extract_tar_gz'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:345:in `block (2 levels) in extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/tar_reader.rb:65:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:342:in `block in extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/file_source.rb:30:in `open'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package/file_source.rb:30:in `with_read_io'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/package.rb:339:in `extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/installer.rb:772:in `extract_files'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/installer.rb:302:in `install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/resolver/specification.rb:97:in `install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/request_set.rb:166:in `block in install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/request_set.rb:156:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/request_set.rb:156:in `install'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:205:in `install_gem'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:255:in `block in install_gems'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:251:in `each'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:251:in `install_gems'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:158:in `execute'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/command.rb:310:in `invoke_with_build_args'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/command_manager.rb:169:in `process_args'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/command_manager.rb:139:in `run'
        from C:/Ruby/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/gem_runner.rb:55:in `run'
        from C:/Ruby/Ruby22/bin/gem:21:in `<main>'
相変わらずダメだった。

Ruby 2.3.3 の場合。
> uru 23
---> now using ruby 2.3.3-p222 tagged as `23`

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

> gem install dxopal
Successfully installed opal-0.11.0
Fetching: dxopal-1.1.0.gem (100%)
Successfully installed dxopal-1.1.0
Parsing documentation for opal-0.11.0
unknown encoding name ""+e)" for lib/opal/cli_runners/node_modules/chrome-remote-interface/chrome-remote-interface.js, skipping
Installing ri documentation for opal-0.11.0
Parsing documentation for dxopal-1.1.0
Installing ri documentation for dxopal-1.1.0
Done installing documentation for opal, dxopal after 132 seconds
2 gems installed
妙なメッセージが出てるけど、一応最後まで通ったらしい。

Ruby 2.4.3 の場合。
> uru 24
---> now using ruby 2.4.3-p205 tagged as `24`

> ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [i386-mingw32]

> gem install dxopal
Successfully installed opal-0.11.0
Fetching: thor-0.19.4.gem (100%)
Successfully installed thor-0.19.4
Fetching: rack-2.0.4.gem (100%)
Successfully installed rack-2.0.4
Fetching: dxopal-1.1.0.gem (100%)
Successfully installed dxopal-1.1.0
Parsing documentation for opal-0.11.0
unknown encoding name ""+e)" for lib/opal/cli_runners/node_modules/chrome-remote-interface/chrome-remote-interface.js, skipping
Installing ri documentation for opal-0.11.0
Parsing documentation for thor-0.19.4
Installing ri documentation for thor-0.19.4
Parsing documentation for rack-2.0.4
Installing ri documentation for rack-2.0.4
Parsing documentation for dxopal-1.1.0
Installing ri documentation for dxopal-1.1.0
Done installing documentation for opal, thor, rack, dxopal after 134 seconds
4 gems installed

つまり…。
  • Windows + Ruby 2.2.x では、DXOpal はインストールできない。
  • Windows + Ruby 2.3.x、Ruby 2.4.x は、管理者権限でコマンドプロンプトを開いてインストール作業をすれば、DXOpal がインストールできないこともない。
という状況らしい。

Linux上ではどうかな。 :

VMware + Ubuntu Linux 16.04 LTS 上で試してみた。

$ sudo apt install ruby

$ ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

$ gem install dxopal
Fetching: sourcemap-0.1.1.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /var/lib/gems/2.3.0 directory.

$ sudo gem install dxopal
Fetching: sourcemap-0.1.1.gem (100%)
Successfully installed sourcemap-0.1.1
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: ast-2.4.0.gem (100%)
Successfully installed ast-2.4.0
Fetching: parser-2.3.3.1.gem (100%)
Successfully installed parser-2.3.3.1
Fetching: opal-0.11.0.gem (100%)
Successfully installed opal-0.11.0
Fetching: thor-0.19.4.gem (100%)
Successfully installed thor-0.19.4
Fetching: rack-2.0.4.gem (100%)
Successfully installed rack-2.0.4
Fetching: dxopal-1.1.0.gem (100%)
Successfully installed dxopal-1.1.0
Parsing documentation for sourcemap-0.1.1
Installing ri documentation for sourcemap-0.1.1
Parsing documentation for hike-1.2.3
Installing ri documentation for hike-1.2.3
Parsing documentation for ast-2.4.0
Installing ri documentation for ast-2.4.0
Parsing documentation for parser-2.3.3.1
Installing ri documentation for parser-2.3.3.1
Parsing documentation for opal-0.11.0
unknown encoding name ""+e)" for lib/opal/cli_runners/node_modules/chrome-remote-interface/chrome-remote-interface.js, skipping
Installing ri documentation for opal-0.11.0
Parsing documentation for thor-0.19.4
Installing ri documentation for thor-0.19.4
Parsing documentation for rack-2.0.4
Installing ri documentation for rack-2.0.4
Parsing documentation for dxopal-1.1.0
Installing ri documentation for dxopal-1.1.0
Done installing documentation for sourcemap, hike, ast, parser, opal, thor, rack, dxopal after 93 seconds
8 gems installed

こちらも、管理者権限(sudo 〜)で作業すればインストールできるっぽい。

DXOpalを試用。 :

管理者権限のコマンドプロンプトを閉じて、通常のコマンドプロンプトを開いてから、DXOpal を試用。

> pik list
  187: ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mswin32]
  187: ruby 1.8.7 (2013-06-27 patchlevel 374) [i386-mingw32]
  193: ruby 1.9.3p551 (2014-11-13) [i386-mingw32]
  200: ruby 2.0.0p648 (2015-12-16) [i386-mingw32]
  219: ruby 2.1.9p490 (2016-03-30 revision 54437) [i386-mingw32]
  220: ruby 2.2.0p0 (2014-12-25 revision 49005) [i386-mswin32_100]
* 226: ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]
  233: ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
  243: ruby 2.4.3p205 (2017-12-14 revision 61247) [i386-mingw32]

> pik 233

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

> mkdir dxopal_test01
> cd dxopal_test01

> dxopal init
DXOpal v1.1.0
Wrote index.html
Wrote main.rb
Wrote dxopal.min.js

> dxopal server
DXOpal v1.1.0
Starting DXOpal Server
(Open http://localhost:7521/index.html in the browser)
---
[2018-02-14 19:48:56] INFO  WEBrick 1.3.1
[2018-02-14 19:48:56] INFO  ruby 2.3.3 (2016-11-21) [i386-mingw32]
[2018-02-14 19:48:56] INFO  WEBrick::HTTPServer#start: pid=10272 port=7521

_http://localhost:7521/index.html をFirefoxで開いたら、「Hello!」の文字と画面が出た。動いてるっぽい。

以上です。

過去ログ表示

Prev - 2018/02 - Next
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28

カテゴリで表示

検索機能は Namazu for hns で提供されています。(詳細指定/ヘルプ


注意: 現在使用の日記自動生成システムは Version 2.19.6 です。
公開されている日記自動生成システムは Version 2.19.5 です。

Powered by hns-2.19.6, HyperNikkiSystem Project