Software‎ > ‎Notes‎ > ‎

OpenWatcom Alpha Compiler

As far as I can tell the only C compiler ever officially released that supports building native binaries for Windows NT running on Alpha systems is Microsoft Visual C++ RISC edition. This compiler does not exactly seem easy to come by - I would likely have to import a copy from America at great cost. So it seems the official compiler is not an option. However, it turns out that Watcom was working on an Alpha code generator (and MIPS and PowerPC) that was never released. And all that code still remains in the OpenWatcom repository. And the Alpha compiler actually (mostly) works. I'm told the MIPS and PowerPC ones don't so I've not bothered to attempt either.

So, to build an alpha cross-compiler grab the OpenWatcom source and binary packages from www.openwatcom.org. I'm using version 1.7.1 but I believe 1.8 should work just as well.
  1. Install OpenWatcom somewhere. C:\WATCOM is good.
  2. Extract the OpenWatcom source code somewhere. I will be using Z:\owsrc here.
  3. Open up Z:\owsrc\setvars.bat in your favourite editor (or copy it and edit the copy if you really want to). Set OWROOT to where ever you extracted the source code (Z:\owsrc) and WATCOM to your OpenWatcom installation (C:\WATCOM)
  4. Start cmd, cd into the sources directory (Z:\owsrc) and run setvars.bat. You should now be in the bld directory (Z:\owsrc\bld)
  5. run ..\build.cmd (Z:\owsrc\build.cmd). This will do a full build of OpenWatcom. By default this will build compilers for Alpha, MIPS and PowerPC as well as the standard x86 one but it only builds the libraries for x86. So we must build the Alpha libraries by hand. The freshly built compiler should end up in the rel2 directory (Z:\owsrc\rel2).
  6. Once the build has finished bring up your editor and change the WATCOM environment variable to point to the freshly built compiler (set it to Z:\owsrc\rel2 or whatever). We must do this because the standard binary package doesn't include the alpha compiler. We can't build the alpha libraries without the alpha compiler. Start a new console and rerun setvars.bat. This console should have access to the alpha compiler now.
  7. CD into each of the following directories and run pmake -d cpu_axp -h and then builder rel2 cpu_axp
    1. clib
    2. mathlib
    3. w32api
    4. dwarf
    5. cg
    6. cfloat
    7. as
    8. owl
    9. plusplus (you may have to do pmake & builder in plusplus\cpplib first)
  8. You should now have a functional C cross-compiler for Alpha NT sitting in the rel2 directory. You can overwrite your WATCOM installation (C:\WATCOM) with this if you want. The IDE should have support for Alpha targets without modification (I think the OpenWatcom people must manually strip the Alpha stuff out of the binary releases)
I don't know if step 7 contains absolutely everything possible but it seems to be enough for me to build my Win32 hello world/floppy disk imaging program. If you have any corrections feel free to send me an email - david@zx.net.nz.

These notes are under what ever license you like. If anyone is feeling motivated it might be good to tidy them up and put them on the OpenWatcom wiki. I'll probably eventually get around to doing it myself if no one else does.


OpenWatcom 1.7 Cross-compiler for DEC Alpha binaries produced with the above instructions are available.