目次: Linux
そういえばゲームをしばらく作っていなかったけれど、今時のゲームはどうやって作るんだろう?と調べていました。
今はスクラッチからガリガリ書くのではなく、ゲームエンジンとして3DならUnityで、2DならCocos2d-xを使うのが定番のようです。スマホゲームはAndroidとiOSに両対応することが普通だと思われてますよね。スクラッチから作ってAndroidとiOSに両方対応させるなんて、想像するだけで辛そうです。ゲームエンジン様々ですよ。
UnityはC# で書く必要があるみたいで、今時のゲームエンジンと3DとC# を同時に覚えようとすると間違いなく挫折するので、2DメインかつC/C++ で書けるCocos2d-xを試します。
いざ始めようとして、そういえばWindowsマシンを持ってない(潰してLinuxマシンにしてしまった)ことに気づきましたが、Linuxでのインストールガイド(公式ドキュメント)もちゃんと用意されていました。さすが。
どのバージョンを使えば良いのかわかりませんが、とりあえず現時点での最新リリース版っぽい3.15.1のタグをチェックアウトしておきます。
$ mkdir -p ~/usr/src/ $ cd ~/usr/src/ $ git clone https://github.com/cocos2d/cocos2d-x.git Cloning into 'cocos2d-x'... remote: Counting objects: 433999, done. remote: Total 433999 (delta 0), reused 0 (delta 0), pack-reused 433998 Receiving objects: 100% (433999/433999), 883.31 MiB | 1.47 MiB/s, done. Resolving deltas: 100% (294953/294953), done. $ cd cocos2d-x $ git checkout cocos2d-x-3.15.1
ビルドします。ビルドする前にcmakeやOpenGL系ライブラリの開発パッケージを入れる必要があります。公式ドキュメントさん曰く、UbuntuやDebianをお使いなら、
cd build
./install-deps-linux.sh
とすると楽にセットアップできるとのこと。私は使ったことがないです。
$ cd cocos2d-x $ cd build $ mkdir linux-build $ cd linux-build $ cmake ../../ ... -- SQLite3 include dirs: /usr/include CMake Error at cmake/Modules/FindPackageHandleStandardArgs.cmake:136 (message): Could NOT find FMOD (missing: FMOD_LIBRARIES FMOD_INCLUDE_DIRS) Call Stack (most recent call first): cmake/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE) cmake/Modules/FindFMOD.cmake:48 (find_package_handle_standard_args) cmake/Modules/CocosBuildHelpers.cmake:44 (find_package) cmake/Modules/BuildModules.cmake:21 (cocos_find_package) CMakeLists.txt:98 (BuildModules) -- Configuring incomplete, errors occurred! See also "/home/katsuhiro/usr/src/cocos2d-x/build/linux-build/CMakeFiles/CMakeOutput.log". See also "/home/katsuhiro/usr/src/cocos2d-x/build/linux-build/CMakeFiles/CMakeError.log".
FMODなるモジュールが無いと怒られました。調べてみるとgitからソースコードを持ってきた場合は、依存ライブラリをダウンロードする一手が必要とのことです。ダウンロードは簡単です。
$ cd cocos2d-x $ ./download-deps.py ======================================================= ==> Prepare to download external libraries! ==> version file doesn't exist ==> Ready to download 'v3-deps-130.zip' from 'https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-130.zip' ==> WARNING: Couldn't grab the file size from remote, use 'zip_file_size' section in '/home/katsuhiro/usr/src/cocos2d-x/external/config.json' ==> Start to download, please wait ... ==> Downloading finished! ==> Extracting files, please wait ... ==> Extraction done! ==> Cleaning cocos2d-x/external folder ... ==> Copying files... ==> Cleaning... ==> Would you like to save 'v3-deps-130.zip'? So you don't have to download it later. [Yes/no]: Yes ==> Saving the dependency libraries by default
もう一度cmakeを実行します。成功しました、良かった良かった。あとはmakeするだけですが、gcc 6.3を使っているせいか、凄まじい量の警告が出ます。ドキュメントを見るとgcc 4.9でビルドするのが推奨みたい?ですが、gccのバージョンに関わらずWarning出るのはダメじゃないの……?
$ cd cocos2d-x $ cd build/linux-build $ cmake ../../ It appears you are building natively for Linux with GCC -- OpenGL include dirs: /usr/include -- GLEW include dirs: /usr/include -- PkgConfig found -- GLFW3 include dirs: /usr/include/GLFW -- SQLite3 include dirs: /usr/include -- FMOD include dirs: /home/katsuhiro/usr/src/cocos2d-x/external/linux-specific/fmod/include -- Fontconfig include dirs: /usr/include/freetype2 ... -- CURL add to include_dirs: /usr/include/x86_64-linux-gnu -- CURL libs added to 'cpp-tests': curl SPIDERMONKEY_LIBRARY: /home/katsuhiro/usr/src/cocos2d-x/external/spidermonkey/prebuilt/linux/64-bit/libjs_static.a -- Configuring done -- Generating done -- Build files have been written to: /home/katsuhiro/usr/src/cocos2d-x/build/linux-build $ make Scanning dependencies of target bullet [ 0%] Building CXX object external/bullet/CMakeFiles/bullet.dir/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp.o ...(かなり時間かかります)...
やっと入り口に立てました。次回はゲームのプロジェクトを作ろうと思います。
この記事にコメントする
目次: 自宅サーバー
サーバのexim4がIPv6 socket creation failedというエラーを出し続けていて、鬱陶しいです。
どうしたものかと思っていたら、同じ症状で悩んでいる人を見つけました。要は設定ファイルにdisable_ipv6 = trueを足せば良いだけみたいですが、Debianのexim4は変な設定方法になっていて苦戦していました。
まずは現在の状態を確認してみます。
# update-exim4.conf # exim4 -bP disable_ipv6 no_disable_ipv6
これは無効(disable)が無効(no)なので、IPv6有効状態です。なんでenable_ipv6じゃないんだろう。変な名前…。
変更方法ですが、先ほどのフォーラムによれば /etc/exim4/update-exim4.conf.confに足しても意味が無くて/etc/exim4/exim4.conf.templateに足すと良いみたいです。
# vim /etc/exim4/exim4.conf.template # update-exim4.conf # exim4 -bP disable_ipv6 disable_ipv6
とりあえず設定ファイルの先頭に足してみたら効いているみたいですが、どこでも良いのか?これ。
一応/usr/share/doc/exim4/README.Debian.gzにマニュアルがありますが、クッソ長くて読む気が起きないです。
拾い読みした感じだと、多分2.1.1.12. Split configuration into small filesの真ん中辺りに書いてある、
If you chose unsplit configuration, update-exim4.conf builds the configuration from /etc/exim4/exim4.conf.template, which is basically the files from /etc/exim4/conf.d/ concatenated together at package build time, and thus guarantees consistency on the target system.
設定ファイルを分割していない人(私がそう)はexim4.conf.templateに全ての設定が書いてあるから、何か足したければexim4.conf.templateに足せば良さそうだな?ってのが何となくわかります。でも、仕組みは良いから使い方を書いてくれないかな…って気分になりますね。
この記事にコメントする
| < | 2017 | > | ||||
| << | < | 06 | > | >> | ||
| 日 | 月 | 火 | 水 | 木 | 金 | 土 |
| - | - | - | - | 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 | - |
25年10月15日
25年10月18日
22年5月5日
25年10月19日
23年4月11日
06年4月22日
25年10月17日
25年10月6日
25年10月13日
20年10月23日
25年10月12日
20年8月29日
19年1月13日
18年10月13日
18年9月3日
18年8月20日
18年7月23日
18年7月22日
18年10月14日
18年11月10日
wiki
Linux JM
Java API
2002年
2003年
2004年
2005年
2006年
2007年
2008年
2009年
2010年
2011年
2012年
2013年
2014年
2015年
2016年
2017年
2018年
2019年
2020年
2021年
2022年
2023年
2024年
2025年
過去日記について
アクセス統計
サーバ一覧
サイトの情報合計:
本日: