CM3 Installation Notes for Windows (x86)

Skim installation.html, ignoring anything about cminstall.

A Microsoft Visual C++ toolset is required. Just about any version should work, from 2.0 through 9.0. You will need the Windows SDK, which is usually included with Visual C++, but some "express" versions do not include it.

Alternative toolsets such as Open Watcom, Digital Mars, Metrowerks CodeWarrior are not currently supported. There is support for GNU/Cygwin and GNU/MinGWin, not documented here.

Just about any version of 32-bit x86 or 64-bit Windows should work, from Windows 95 to Server 2008. Modula-3 currently only targets x86 on Windows, however 64-bit Windows can run x86 code. The bulk of testing occurs on x86 and AMD64 Windows XP. If anyone is interested in CM3 running on or targeting any Windows operating system version prior to Windows XP, send mail to m3devel.

A redistributable C runtime update may be needed on the target system, such as


Open a command prompt ("cmd", or "command" on Windows 9x) There is also a shortcut on the start menu to this and you may use it.

Run vcvars32.bat or vsvars32.bat, such as:

    C:\msdev\80>dir /s/b v*bat
    C:\msdev\80\Common7\Tools\vsvars32.bat  <--

Ensure your toolset is working (in the style of

    echo main() { puts("hello"); } > hello.c
    cl -nologo hello.c
    ==> hello
    del hello.c hello.exe hello.obj

If you are going to rebuild CM3 from source, ensure you have a working version of cvs. You can get this from

For 5.5.0 or later, skip ahead.

For 5.2.6 and earlier, do the folowing, making appropriate substitutions:

    rem Create and go to an install location of your choice:
      mkdir C:\cm3
      cd /d C:\cm3

    rem Extract the top-level wrapper archive:
      tar xvfz <path>\cm3-min-WIN32-NT386-<version>.tar.gz

    rem Delete the old install mechanism:
      del cminstall.exe tar.exe gzip.exe cygwin.dll

    rem read the license:
      start wordpad COPYRIGHT-CMASS

    rem Extract the real contents:
      tar xfz system.tgz

    rem Put cm3.exe in %PATH%:
      set PATH=C:\cm3\bin;%PATH%

    rem Delete old broken .libs:
      del /q c:\cm3\lib\*

If you are going to build your own current compiler: Checkout the current source from CVS. Do not fetch an older release.

    mkdir c:\src
    cd /d c:\src
    cvs -d login

There is no password (simply type return). Then you can checkout everything with

    cvs -z4 -d checkout cm3

Take the checked in configuration verbatim:

    del c:\cm3\bin\cm3.cfg
    copy c:\src\cm3\m3-sys\cminstall\src\config\NT386* c:\cm3\bin\cm3.cfg

OR if you are just going to stick with 5.2.6, get a current config file; click where it says "text" next to "download";
save the file to c:\cm3\bin\cm3.cfg, replacing the file that came from system.tgz. You will also need NT386.common, placed in the same directory.

Make sure your cm3 compiler can run:

    cm3 -version
    ==> Critical Mass Modula-3 version 5.2.6
        last updated: 2003-06-27
        configuration: cm3.cfg

If this does not work, you probably forgot:

    set PATH=C:\cm3\bin;%PATH%

Build a test program:

    mkdir \scratch
    cd \scratch
    echo MODULE Hello EXPORTS Main; > Hello.m3
    echo IMPORT IO; >> Hello.m3
    echo BEGIN >> Hello.m3
    echo  IO.Put("Hello"); >> Hello.m3
    echo END Hello. >> Hello.m3
    ==> Hello

There can be link erors here. For example if you forgot to delete \cm3\lib\*. Or if you don't have a Platform SDK. These errors will be fixed when we build our own Windows .libs. For most people though, this should work (remember to delete \cm3\lib\*).

If you are just going to use 5.2.6, you are done. If you want to build a current system from source, continue.

    cd /d c:\src\cm3\scripts\win


Instead of scripts\win\*.cmd, you are STRONGLY encouraged to instead install Python from or and then:

    cd /d c:\src\cm3\scripts\python

Upgrade does A LOT. It starts with a sanity check of your environment. Some of what upgrade does will appear to be the same thing repeated. It might even be. That is ok. In particular, older compilers cannot build newer Modula-3 runtimes, so the currently installed compiler is first used to build a current compiler with the currently installed runtime. Then that compiler is used to build the new system.

When upgrade finishes successfully it should clearly indicate so, with a message such as, currently:

    upgrade : Done.
    upgrade : You should now have a current compiler, runtime, and core
    upgrade : packages, and be able to build and/or ship "anything" up to and
    upgrade : including "standard". i.e. do-cm3-std buildship, or cd around the
    upgrade : source tree and cm3 or cm3 -ship.

If you run cm3 -version now, you should get something more recent, such as:

    Critical Mass Modula-3 version d5.7.0
        last updated: 2008-03-16
        configuration: C:\cm3\bin\cm3.cfg

and your C:\cm3 directory should have many more files than previously, if you started with a "min" archive.

Now that your system is current, you can rebuild it more easily/quickly.

For 5.5.0 or later. In this case, the archive is a bit more ready to go from the start. cminstall is deleted, the cm3.cfg file is ready to go, and the compiler is more up to date so there is less motivation to rebuild it from source. (To be fair, 5.2.6 works fine, it is just not to MY taste.)

    tar tf <path>\cm3-min-WIN32-NT386-<version>.tar.bz2 | more

to get a quick feel of the structure -- does it have a version specific prefix or not.

Some versions look like:


and some look like:


So a good install process is either:

    cd /d c:\
    rmdir /q/s cm3
    tar xf <path>\cm3-min-WIN32-NT386-<version>.tar.bz2
    set PATH=C:\cm3\bin;%PATH%


    cd /d c:\
    rmdir /q/s cm3
    tar xf <path>\cm3-min-WIN32-NT386-<version>.tar.bz2
    ren cm3-min-WIN32-NT386-<version> cm3
    rem or if you like to keep backups
      xcopy /fiverdyh cm3-min-WIN32-NT386-<version> cm3
    set PATH=C:\cm3\bin;%PATH%

And you are all set.

If you are using Visual C++ prior to 6.0, del \cm3\lib\*, checkout source from cvs, and build in m3-win/imports-libs.

You may now optionally continue on to:
build a test program
rebuild cm3 from source

However there are simpler faster ways to rebuild cm3 from source since you are starting with a newer compiler/runtime. Upgrade.[cmd,py] is pessimistic in order to support building a new compiler from an old compiler/runtime.

You can do something like:

    cd /d c:\src\cm3\scripts\win
    .\do-cm3-front buildship
    rem the compiler cannot "ship" (copy) itself, so:
      install-cm3-compiler upgrade
      rem see also install-cm3-compiler help

To rebuild clean:

    .\do-cm3-front realclean
    .\do-cm3-front buildship

Or build specific packages like:

    set p=m3middle m3front cm3
    .\do-pkg realclean %p%
    .\do-pkg buildship %p%

Again, you are strongly encouraged to use the Python programs instead.