Open Watcom V2
エディタの記事を書いている内に思い出した Watcom C/C++ 。懐かしくなって調べてみたら、オープンソースにあるようです。
https://github.com/open-watcom/open-watcom-v2
Open Watcom は元々パッケージソフトの Watcom の C/C++ や Fortran の開発環境がオープンソースになったもので、バージョン 1.9 まで開発され、v2 はそれからフォークしたものようです。
Open Watcom v2-Debian – Qiita を見ると、Linux 上から DOS の実行ファイルもコンパイル出来るようです。
Raspberry Pi OS で動かないか試してみました。
$ git clone https://github.com/open-watcom/open-watcom-v2.git $ cd open-watcom-v2 $ ./build.sh ・ ・ ======= 11:13:27 /home/pi/work/Watcom/open-watcom-v2/bld/browser/nt386 ======== %make prepare_gendev_tmp_batch gendev mono01.cop sh: 1: dosemu: not found Error(E14): Cannot execute (dosemu): No such file or directory Error(E42): Last command making (gencop;mono01.cop) returned a bad status Error(E02): Make execution terminated Error(E42): Last command making (/home/pi/work/Watcom/open-watcom-v2/docs/nt/wbrw.gh) returned a bad status Error(E02): Make execution terminated <pmake -d build -h> => non-zero return: 512 Build failed
ああ、dosemu が必要です、しかし、dosemu は x86 専用です。Raspberry Pi OS にはありません。
$ grep -Rl dosemu . ./setvars.sh ./bld/wgml/test/test.sh ./build/mif/wgmlcmd.mif ./build/binbuild/build.log
setvars.sh を見ると、DOSBox が使えるようです。DOSBox-X があるので、それを使ってみましょう。
# export OWDOSBOX=dosbox
となっているので、次のようにしました。
export OWDOSBOX=dosbox-x
$ ./clean.sh ・ ・ $ ./build.sh ・ ・
念の為、クリアしてからコンパイルし直しました。だいだい、2 時間くらいでコンパイルが終わりました。次に、ファイルをまとめます。
$ ./build.sh rel ・ ・
これで、rel ディレクトリに必要なファイル(exe ファイルとか余分なものもありますが)がまとまったので、/usr/local/bin にコピーします。
$ sudo cp -r rel /usr/local/bin/watcom
後は、環境変数PATH に /usr/local/bin/watcom/binl を追加し、環境変数 WATCOM と INCLUDE を設定します。
$ export PATH=/usr/local/bin/watcom/binl:$PATH $ export WATCOM=/usr/local/bin/watcom $ export INCLUDE=/usr/local/bin/watcom/h
簡単なプログラムを作成して、DOSBox-X で動かしてみました。
test.c
#include <stdio.h> int main() { printf("Wellcome to Watcom C\n"); return 0; }
コンパイルします。
$ wcl -l=com -fe=TEST.COM test.c Open Watcom C/C++ x86 16-bit Compile and Link Utility Version 2.0 beta Aug 21 2021 18:34:24 (32-bit) Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved. Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. wcc test.c Open Watcom C x86 16-bit Optimizing Compiler Version 2.0 beta Aug 21 2021 18:14:01 (32-bit) Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved. Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. test.c: 8 lines, included 802, 0 warnings, 0 errors Code size: 19 wlink @__wcl__.lnk Open Watcom Linker Version 2.0 beta Aug 21 2021 18:01:34 (32-bit) Copyright (c) 2002-2021 The Open Watcom Contributors. All Rights Reserved. Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. loading object files searching libraries creating a DOS .COM executable $
DOSBox-X から見えるディレクトリにコピーして実行してみました。
C:¥>test Wellcome to Watcom C C:¥>
無事動きました。Raspberry Pi で DOS プログラムが作れます。でも、使いみちがあるかな?
ディスカッション
コメント一覧
まだ、コメントがありません