Skip to content

Installation

Derek Snider edited this page Jul 23, 2026 · 2 revisions

Installation

madc builds from source on Linux (x86-64 is the validated platform today; the MIR backend also targets aarch64, ppc64le, s390x, and riscv64).

Requirements

  • clang++ or g++ with C++11 support
  • The madc MIR fork (libmir + c2mir) — see Step 1

Step 1: Build the MIR fork

madc's backend is MIR — but madc requires its own fork, not upstream MIR. The fork carries native C99 _Complex, __attribute__((cleanup)), ≤16-byte SIMD/vector support, direct ELF object/executable emission, DWARF debug info, PIC codegen, and the ABI fixes madc's IR depends on.

Clone madc first (its MIR_COMMIT file pins the exact fork commit each madc revision is verified against), then build the fork at /workspace/mir:

git clone https://github.com/derekbsnider/madc.git
git clone -b develop https://github.com/derekbsnider/mir /workspace/mir
git -C /workspace/mir checkout "$(cat madc/MIR_COMMIT)"   # pin to the verified commit
make -C /workspace/mir

Fork releases are tagged v<upstream-base>-madc.<madc-version> (e.g. v1.0-madc.0.38.0) — each pairs with the madc release named in its suffix, and madc's MIR_VERSION file names the fork release it depends on. Checking out a release tag instead of the MIR_COMMIT pin works when building a tagged madc release.

Step 2: Build madc

cd madc
make -C src

The binary lands at bin/madc.

Step 3: Verify

bin/madc tests/testint.mad

You should see output like:

123: 123
i: 456
j: 456

Optional: Install system-wide

sudo cp bin/madc /usr/local/bin/

Then you can run madc from anywhere:

madc myprogram.mad

Running the test suite

make -C src fulltest    # unit tests + all integration tests

This runs the doctest unit suites (9,000+ assertions) and 740+ integration tests. Everything should pass on a clean build.

What's next?

Clone this wiki locally