Skip to content

Getting Started

Eric Sessoms edited this page Jan 3, 2022 · 8 revisions

tl;dr

curl -LO https://github.com/modula3/cm3/releases/download/d5.11.4/cm3-dist-AMD64_LINUX-d5.11.4.tar.xz
tar xf cm3-dist-AMD64_LINUX-d5.11.4.tar.xz
mkdir build
cd build
../cm3-dist-AMD64_LINUX-d5.11.4/scripts/concierge.py install --prefix $HOME/cm3
PATH=$HOME/cm3/bin:$PATH

See also

Introduction

cm3 is a self-hosted compiler for Modula-3. This means that you generally need a Modula-3 compiler to build cm3. But if you're just getting started you won't have Modula-3, so our distribution includes a C++ bootstrap compiler. The full install process is

  1. build the bootstrap compiler,
  2. use the bootstrap compiler to build the full compiler, and
  3. use the full compiler to build and install the included Modula-3 libraries.

Use the provided install script to automate the process.

You may then wish to try the tutorial.

Prerequisites

The default install requires Python 3, CMake, and a C++ compiler.

cm3 includes an optional UI system Trestle, which additionally depends on X11 and OpenGL. If you install the required development libraries (on Debian-derived systems that's xorg-dev and libglu1-mesa-dev, on MacOS install xquartz, libxaw, and libxft), you can build the UI components with

cm3-d5.11.4/scripts/concierge.py install --prefix $HOME/cm3 all

Supported Platforms

cm3 is expected to work on 32- or 64-bit Windows (with or without Mingw), and on any 32- or 64-bit posix-ish platform. It is tested on 32- and 64-bit Windows, 64-bit MacOS (Intel), 32- and 64-bit Linux (Intel), and 64-bit Linux (Arm). Because this is a source distribution, the provided downloads are more generally useful than their names would suggest.

  • AMD64_LINUX works on Linux x86_64, Linux aarch64, and MacOS x86_64 (and likely MacOS on M1 as well)
  • AMD64_NT works on Windows x64 and Mingw x86_64
  • I386_LINUX works on Linux i686
  • I386_NT works on Windows x86 (but not yet Mingw i686)

For untested platforms, try the most similar distribution, i.e., AMD64_LINUX for FreeBSD.

Targets

CM3 does not always succeed in correctly identifying the target system. Sometimes this is because systems are ambiguous, such as with the myriad of possibilities available on Windows, and sometimes this is just a bug.

If CM3 is failing to detect your system, you can try helping the script along by adding the --target option to the install command, i.e.,

../cm3-dist-AMD64_LINUX-5.11.4/scripts/concierge.py install --target ARM64_LINUX --prefix $HOME/cm3

See here for a list of potential target names https://github.com/modula3/cm3/tree/master/m3-sys/cminstall/src/config-no-install

Legacy Platforms

cm3 continues to support a variety of historically important systems, but the bootstrap compiler and associated source distribution are not tested on any of these systems for lack of availability. If you have one of these systems, you are probably better served by checking out the source and performing an upgrade.