【MSX】ubuntu20.04でopenMSX+debuggerの環境を構築する
WindowsにはblueMSXというデバッガ機能を内蔵した強力なエミュレータがあるが、Linux(ubuntu)には用意されていない。
そこで、openMSXに用意されているdebuggerを使って、デバッグ環境を構築してみる。
なお、openMSXはリポジトリからのインストールも可能だが、今回はgithubに公開されているソースからビルドする。
openMSXのインストール
githubからcloneする。
$ git clone https://github.com/openMSX/openMSX.git
configureする。
$ cd openMSX $ ./configure
すると以下の出力がされる。
Using Python: python3 Probing target system... Creating derived/x86_64-linux-opt/config/probed_defs.mk... Creating derived/x86_64-linux-opt/config/systemfuncs.hh... Found libraries: ALSA: version 1.2.2 GLEW: no libogg: no libpng: version 1.6.37 libtheora: no libvorbis: no OpenGL: version 4.6 SDL2: version 2.0.10 SDL2_ttf: no Tcl: version 8.6.10 zlib: version 1.2.11 Components overview: Emulation core: no GL renderer: no Laserdisc: no ALSA MIDI: yes Customisable options: Install to /opt/openMSX (you can edit these in build/custom.mk) Please install missing libraries and headers and rerun "configure". If the detected libraries differ from what you think is installed on this system, please check the log file: derived/x86_64-linux-opt/config/probe.log
このうち、Found Libraries
のところでno
と出ているのが不足しているライブラリになる。
追加でインストールする。
$ sudo apt install libglew-dev $ sudo apt install libogg-dev $ sudo apt install libtheora-dev $ sudo apt install libvorbis-dev $ sudo apt install libsdl2-ttf-dev
make、install。
$ sudo make $ sudo make install
起動する。
BIOSを適切に配置して設定すると実機と同様にBASICが使えるが、素の状態ではC-BIOSという互換BIOSが起動する。
$ openmsx &
debuggerのインストール
OpenMSX debuggerにはqt5が必要なのでインストールする。
$ sudo apt install qtbase5-dev qttools5-dev-tools qt5-default
githubからcloneする。
$ git clone https://github.com/openMSX/debugger.git
configureはないので、そのままmake。
$ cd debugger $ make
するとエラーが出る。
Compiling DebuggerForm.cpp... src/DebuggerForm.cpp: In member function ‘void DebuggerForm::createForm()’: src/DebuggerForm.cpp:624:45: error: ‘SkipEmptyParts’ is not a member of ‘Qt’ 624 | QStringList s = list.at(i).split(" ", Qt::SkipEmptyParts); | ^~~~~~~~~~~~~~ src/DebuggerForm.cpp: In member function ‘void DebuggerForm::setDebuggables(const QString&)’: src/DebuggerForm.cpp:1454:38: error: ‘SkipEmptyParts’ is not a member of ‘Qt’ 1454 | QStringList l = list.split(" ", Qt::SkipEmptyParts); | ^~~~~~~~~~~~~~ make: *** [build/main.mk:326: derived/obj/DebuggerForm.o] Error 1
表示されたとおり、Qt::SkipEmptyParts
がqt
にないよ、と言われている。
調べてみると現在のバージョンでは廃止になっているようで、代わりにQString::SplitBehavior::SkipEmptyParts
を使う模様。
エラーに出ているsrc/DebuggerForm/cpp
の624行目と1454行目の該当箇所を書き換えて、改めてmake。
2021/9/9 追記
z88dkの.mapを読んでdisassemblerウィンドウにラベルを表示するパッチを適用する。
以下からzipを取得して展開。
[openmsx-debugger で z88dk の -m 形式の .map symbol を読ませる hack (github.com)]
中にある0001-add-z88dk-symbol-read-hack.patch
をopenmsx-debugger
ディレクトリに配置し、以下コマンドを実行。
$ patch -p1 < 0001-add-z88dk-symbol-read-hack.patch
@h1romas4さん、ありがとうございました!
無事にコンパイルできたら、openmsxと同じ場所にコピーしておく。(make install
は用意されていない)
$ sudo cp -p derived/bin/openmsx-debugger /usr/local/bin
起動してみる。
$ openmsx & $ openmsx-debugger &
起動したデバッガーウィンドウのメニューから[System]-[Connect]を選ぶか、[Ctrl]+[C]を押す。 メモリやレジスタなどの情報が表示されれば、ひとまず成功。
補足
この記事の内容は、ubuntu20.04、及びWindows10+WSL2のubuntu20.04で実施済です。
また、記事執筆時点(2021/8/31)でのソース及びライブラリの状態での結果ですので、今後はエラーが解消していたり、新しいエラーが発生する可能性があります。
この記事を参考に作業される場合は、上記をご理解の上、行ってください。