mieki256's diary



2023/10/13(金) [n年前の日記]

#6 [ruby][windwos] Windows10 + Ruby 3.2.2 x86上で Gosu をインストールした

Windows10 x64 22H2 + Ruby 3.2.2 x86 (RubyInstaller2 DevKit付き) 上で、2Dゲーム制作ライブラリ Gosu がインストールできるのか試してみた。

Ruby 3.2.2 をインストール :

Windows上での Rubyインストールには、RubyInstaller2 を使った。

_RubyInstaller for Windows
_Downloads

一般的には、64bit OS上なら 64bit版 Ruby をインストールするものだろうけど、ゲーム制作の場合、使用する DLL が32bitだったりすることもあるので、今回は32bit版(x86版)をインストールしておいた。

rubyinstaller-devkit-3.2.2-1-x86.exe を入手してインストール。最後に、DOS窓が開いて MSYS2 (DevKit) のインストールもされる。「数字を入力せよ」っぽい感じのメッセージが出てくるけれど、とりあえず Enter を叩いておけばいいらしい。

全部で1GB以上になるファイルがインストールされた。Ruby のバージョンを確認。
> ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [i386-mingw32]

Gosuをインストール :

gem を使って、Gosu をインストール。
gem install gosu
> gem install gosu
Fetching gosu-1.4.6.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed gosu-1.4.6
Parsing documentation for gosu-1.4.6
Installing ri documentation for gosu-1.4.6
Done installing documentation for gosu after 0 seconds
1 gem installed

gosu 1.4.6 がインストールされた。

Gosu は、DevKit (MSYS2) を使って、バイナリをビルドする形でインストールされる。DXRuby と違って、どのバージョンの Ruby でも Gosu が動作するのは、インストール時に、その Ruby のバージョンに合わせたバイナリをわざわざビルドしているから、なのだろう…。

以前書いた Gosu用のサンプルがあるので、ソレを使って動作確認した。

_GitHub - mieki256/gosu_examples_mieki256: Ruby + Gosu examples by mieki256.

少なくとも表示関係のサンプルは動いてくれた。

OpneGL関係のパッケージもインストール :

以下は gosu + OpenGL を動かす場合に必要になるパッケージだけど、この3つを入れずに opengl-bindings をインストールしたほうが良い。が、一応メモしておく。
gem install opengl
gem install glu
gem install glut
> gem install opengl
Fetching opengl-0.10.0.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed opengl-0.10.0
Parsing documentation for opengl-0.10.0
Installing ri documentation for opengl-0.10.0
Done installing documentation for opengl after 0 seconds
1 gem installed
> gem install glu
Fetching glu-8.3.0.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed glu-8.3.0
Parsing documentation for glu-8.3.0
Installing ri documentation for glu-8.3.0
Done installing documentation for glu after 0 seconds
1 gem installed

opengl, glu まではインストールできた。しかし、glut はインストールに失敗した。エラーが出る。

> gem install glut
Fetching glut-8.3.0.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing glut:
        ERROR: Failed to build gem native extension.

    current directory: D:/Ruby/Ruby32-x86/lib/ruby/gems/3.2.0/gems/glut-8.3.0/ext/glut
D:/Ruby/Ruby32-x86/bin/ruby.exe extconf.rb
checking for glVertex3d() in -lopengl32.lib... no
checking for -lopengl32... yes
checking for -lglut... yes
checking for GL/freeglut.h... no
checking for GL/glut.h... no
checking for GLUT/glut.h... 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=D:/Ruby/Ruby32-x86/bin/$(RUBY_BASE_NAME)
        --enable-win32-cross
        --disable-win32-cross
        --with-opengl32.lib-dir
        --without-opengl32.lib-dir
        --with-opengl32.lib-include
        --without-opengl32.lib-include=${opengl32.lib-dir}/include
        --with-opengl32.lib-lib
        --without-opengl32.lib-lib=${opengl32.lib-dir}/lib
        --with-opengl32.liblib
        --without-opengl32.liblib
        --with-opengl32-dir
        --without-opengl32-dir
        --with-opengl32-include
        --without-opengl32-include=${opengl32-dir}/include
        --with-opengl32-lib
        --without-opengl32-lib=${opengl32-dir}/lib
        --with-opengl32lib
        --without-opengl32lib
        --with-glut-dir
        --without-glut-dir
        --with-glut-include
        --without-glut-include=${glut-dir}/include
        --with-glut-lib
        --without-glut-lib=${glut-dir}/lib
        --with-glutlib
        --without-glutlib
        --with-GL-dir
        --without-GL-dir
        --with-GL-include
        --without-GL-include=${GL-dir}/include
        --with-GL-lib
        --without-GL-lib=${GL-dir}/lib
        --with-GLUT-dir
        --without-GLUT-dir
        --with-GLUT-include
        --without-GLUT-include=${GLUT-dir}/include
        --with-GLUT-lib
        --without-GLUT-lib=${GLUT-dir}/lib

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

  D:/Ruby/Ruby32-x86/lib/ruby/gems/3.2.0/extensions/x86-mingw32/3.2.0/glut-8.3.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in D:/Ruby/Ruby32-x86/lib/ruby/gems/3.2.0/gems/glut-8.3.0 for inspection.
Results logged to D:/Ruby/Ruby32-x86/lib/ruby/gems/3.2.0/extensions/x86-mingw32/3.2.0/glut-8.3.0/gem_make.out

mkmf.log に色々記載されてるらしいので眺めてみたけど何が何やら。

ここで、昔書いた手元のメモを眺めたら、opengl-bindings をインストールすれば opengl, glu, glut をインストールしなくてもよい、みたいなことが書いてあった。そちらを入れてみる。

> gem uninstall glu
> gem uninstall opengl
> gem install opengl-bindings
Fetching opengl-bindings-1.6.13.gem
Successfully installed opengl-bindings-1.6.13
Parsing documentation for opengl-bindings-1.6.13
Installing ri documentation for opengl-bindings-1.6.13
Done installing documentation for opengl-bindings after 7 seconds
1 gem installed

opengl-bindings 1.6.13 がインストールされた。

昔書いた、gosu + OpenGL関係のサンプルで動作確認。

_gosu_examples_mieki256/opengl at master - mieki256/gosu_examples_mieki256 - GitHub

opengl-bindings を使った場合は、01 - 18 まで動作してくれた。ちなみに、opengl, glu をインストールした場合は、01 - 15 までしか動作しなかったので、どうやら opengl-bindings を使ったほうが良さそうだなと…。

以上です。

過去ログ表示

Prev - 2023/10 - 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
29 30 31

カテゴリで表示

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


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

Powered by hns-2.19.6, HyperNikkiSystem Project