Building or installing

I provide packages for a number of Linux distros. These packages are the recommended method of installing mrcal. If you're interested in support for some other Linux distro or some other distribution method or even a non-Linux OS, get in touch; I will help. Notes on specific systems below.

Installing from packages

mrcal is included in recent versions of Debian and Ubuntu. So if you're running at least Debian 12 (bookworm) or Ubuntu 22.04 (jammy), you can install with a single command. For instance the commandline tools and the C development library and the Python library can be installed with

apt install mrcal libmrcal-dev python3-mrcal

Ubuntu/resolute (26.04 LTS) currently has the latest mrcal release.

The older distros will have older releases of mrcal. To get the most recent mrcal packages, you can use the mrcal APT repository. I currently distribute packages for

  • Debian/trixie (13)
  • Debian/bookworm (12)
  • Debian/bullseye (11)
  • Ubuntu/noble (24.04 LTS)
  • Ubuntu/jammy (22.04 LTS)
  • Ubuntu/focal (20.04 LTS)

amd64 and arm64 architectures only. To use these, add to your /etc/apt/sources.list:

deb [trusted=yes] http://mrcal.secretsauce.net/packages/DISTRO/public/ DISTRO main

where DISTRO is one of

  • trixie
  • bookworm
  • bulleye
  • noble
  • jammy
  • focal

Then, apt update && apt install mrcal. The chessboard corner finder, while not strictly required, is needed if you're doing chessboard-based calibrations. apt install mrgingham

Non-Debian releases

pip

There're wheels on pypi. For Linux (amd64) and macos (arm64). Pip is a giant hack. These were a huge pain to build, even with Claude's help. They're massively inefficient, and probably are missing things.

Everything mrcal does should be there. Plotting should be there (gnuplot is shipped, with x11 and qt terminals for osx); it should just work. Tell me if it doesn't. pyfltk and the GL image widget are available (mrcal-stereo should work). vnlog is available. mrgingham is not available: building opencv was an endless timesuck; the pip-building tools suck.

If at all possible, use the Debian packages instead.

RPM-based distros

There's a package definition in packaging/rpmpackage.spec. This used to work, and with a small amount of effort, this can work again. If you'd like to see mrcal be a part of Fedora, or some other RPM-based system, please get in touch.

MacOS

mrcal and everything it depends on can build and run with homebrew today. Some of the dependencies and mrcal itself are not actually in homebrew. If you'd like to see mrcal be a part of homebrew, please get in touch.

Windows

mrcal builds with clang today. MSVC builds are possible with small patches. If this is important to you, get in touch.

Building from source

If you cannot use the packages for whatever reason, you must build from source. This is only recommended for developers; end users are not expected to be doing this. Since mrcal is in Debian, this can be done exactly like rebuilding every Debian package out there. You download the sources of the Debian packages:

apt source mrcal

or

debcheckout mrcal

or

git clone https://salsa.debian.org/science-team/mrcal

Then you install the build-time dependencies:

cd mrcal
sudo apt build-dep .

And then you build. In general for all Debian packages this is something like

dpkg-buildpackage -us -uc -b

Here if we're just building mrcal without installing, it's simply

make

On non-Debian systems you have to get the dependencies manually, using the package definitions as a guideline. The dependencies are listed in the Build-Depends section of the debian package definition. Most of these are available in most distros. Things that may not be:

  • mrbuild: the build system. If you can't get it from the package manager, just run make, and follow the printed message to get a local copy of mrbuild. Version 1.14 or above is required.
  • libdogleg-dev: the optimization library. You need at least version 0.15.3.
  • vnlog: the toolkit to manipulate textual tables. You only need this for the test suite. There's nothing to build. Simply downloading the sources and pointing the PATH there is sufficient.
  • python3-numpysane: The make-numpy-reasonable library. You absolutely need at least version 0.35. Available in the usual places Python libraries live. This is a python-only library. Simply downloading the sources and pointing the PYTHONPATH there is sufficient.
  • python3-gnuplotlib: The plotting library used in all the visualizations. You need at least version 0.38. Available in the usual places Python libraries live. This is a python-only library. Simply downloading the sources and pointing the PYTHONPATH there is sufficient.
  • mrgingham: the chessboard corner finder. This isn't strictly a requirement - any corner finder can be used. If you want to use this one (and you can't use the packages), you need to build it.
  • re2c: parser-generator for the C code to parse .cameramodel files. At least version 2 is required.
  • python3-yaml: yaml parser used for the OpenCV, Kalibr model reading
  • python3-fltk: Python bindings for the FLTK GUI toolkit. Optional. Most notably used in the mrcal-stereo --viz stereo visualizer, but will be used more widely over time.
  • python3-gl-image-display: an image widget for FLTK. Optional. Used together with python3-fltk
  • libelas-dev: the ELAS stereo matcher. Used as an option in the mrcal-stereo tool. Optional.

Once these are all downloaded and built (where needed), we can talk about building mrcal. The build-time executables (re2c) must be found in the PATH, the Python libraries in PYTHONPATH, and the C headers and libraries must be findable via the flags in CFLAGS and LDFLAGS respectively. Anything that hasn't been installed to a standard location must be pointed to via the environment. So to build:

export PATH=$PATH:extra_path_to_executables
export PYTHONPATH=extra_path_to_python_libraries

CFLAGS=-Iextra_path_to_c_headers LDFLAGS="-Lextra_path_to_libraries -Wl,-rpath=extra_path_to_libraries" make

If everything has been installed to a standard location, you just run make without any of the extra stuff. The build should then complete successfully, and the test suite should pass:

make test-nosampling

If stuff doesn't work, feel free to bug me.