Building from Source

FreeRouting 2.0.0 is a C++ program with a Qt graphical interface. Compiling means: you download the source archive, install a compiler and Qt, then turn the sources into a native freeRouting binary. There is no Java compiler and no Java runtime in this process. A ready-made binary is described under Getting FreeRouting.

The published sources are the freeRouting folder inside freeRouting-2.0.0.tar.gz on the ChangeLog page. Unpack that archive and work only in that folder. It contains the project file freeRouting.pro, the C++ tree src, the Qt resource file resources.qrc, translations and helper files under resources, the GPL license, and a short README.

Two tools drive the build. qmake reads freeRouting.pro and writes a makefile for your compiler. make (on Windows: nmake, jom or mingw32-make) then compiles everything. The finished program is bin/freeRouting on Linux and macOS, and bin/freeRouting.exe on Windows.

If you prefer a graphical workflow, you can open freeRouting.pro in Qt Creator (shipped with the official Qt installer) and use its Build button instead of typing the commands. The rest of this page describes the command-line path, which is the same on every platform once Qt and a compiler are installed.

Dependencies

You need all of the following:

  • a C++ compiler that understands C++17,
  • Qt with the Widgets module (Widgets also pulls in Gui and Core; those three are enough),
  • qmake, which comes with Qt,
  • a make tool: GNU make on Linux and macOS; nmake or jom with MSVC, or mingw32-make with MinGW, on Windows.

You do not need Java, CMake, extra Qt modules such as Network, QML or WebEngine, or any other CAD package in order to compile.

Check that qmake is the Qt you intended before you start:

qmake -v

The output must mention Qt 5.15 or Qt 6. On some Linux distributions the Qt 6 binary is called qmake6; use that name then, or the qmake that lives in the bin folder of your Qt kit. If several Qt versions are installed, always call the qmake that belongs to the kit you want (a leftover Qt 4 qmake on the PATH will not work).

Supported Qt versions

The sources are written for Qt 5.15 and for Qt 6. Short version checks in the code cover the API differences between the two (string encoding, mouse and wheel events). Any current Qt 6 series (6.2, 6.5, 6.8, …) is fine as long as Widgets is present.

Use a matching compiler kit: MSVC with an MSVC build of Qt, MinGW with a MinGW build of Qt, GCC or Clang with the Linux or macOS Qt. Mixing a MinGW qmake with an MSVC compiler, or the other way round, fails at link time.

Qt 5.15 is the last Qt 5 release and the Qt 5 version to use. Older Qt 5 is not a supported target. Qt 4 is not supported.

Get the sources

Download freeRouting-2.0.0.tar.gz from the ChangeLog page and unpack it so that you have a directory named freeRouting. On Linux and macOS:

tar -xzf freeRouting-2.0.0.tar.gz
cd freeRouting

On Windows 10 and 11 the same tar command works in cmd or PowerShell. You can also unpack the archive with 7-Zip or the Explorer (open the .tar.gz, then the inner .tar, and copy the freeRouting folder to a writable path without spaces if you want to keep the command line simple). Then open a terminal in that freeRouting folder.

All following commands assume the current directory is freeRouting, next to freeRouting.pro.

Linux

Install a compiler, GNU make, and the Qt development files. On Debian and Ubuntu, Qt 6 looks like this:

sudo apt install build-essential qt6-base-dev qt6-base-dev-tools

If qmake6 is still missing, install the package that provides it on your release (often qmake6). Then:

qmake6
make

If qmake6 -v does not print Qt 6, pass the full path, for example /usr/lib/qt6/bin/qmake. Parallel compiles are faster: make -j8 uses eight cores.

To stay on Qt 5.15 from the distribution (where it is still packaged):

sudo apt install build-essential qtbase5-dev qt5-qmake
qmake
make

On Fedora the Qt 6 development package is qt6-qtbase-devel together with gcc-c++ and make. On Arch Linux install base-devel and qt6-base and call qmake6. Other distributions need the same pieces under their own package names: a C++17 compiler, make, and the Qt Widgets development package.

The binary is bin/freeRouting. Start it with ./bin/freeRouting, or pass a Specctra dsn file. ./bin/freeRouting -h lists the command-line options.

Windows

Use a 64-bit Windows 10 or 11 machine. Pick one compiler family and stay with it.

For MSVC, install Visual Studio (the free Community edition is enough) with the workload Desktop development with C++. Then install Qt from the Qt Open Source installer and select a kit that matches that Visual Studio, for example Qt 6.x MSVC 2022 64-bit or Qt 5.15 MSVC 2019 64-bit.

Open the Qt MSVC Command Prompt that the installer puts in the Start menu (or a x64 Native Tools prompt from Visual Studio, with the Qt bin directory added to PATH). In the freeRouting folder:

qmake
nmake

jom is a drop-in replacement for nmake that compiles several files at once. If the Qt installer provided it, jom is the better command. The result is bin\freeRouting.exe.

For MinGW, install a MinGW kit of Qt 5.15 or Qt 6 and use the Qt MinGW Command Prompt. Then:

qmake
mingw32-make

Do not run a plain cmd window unless qmake and the compiler are already on PATH. nmake is not recognized almost always means the Visual Studio environment is not loaded. Unknown module(s) in QT: widgets means that qmake is not from a Qt kit that includes Widgets.

Start the program with bin\freeRouting.exe. bin\freeRouting.exe -h prints the options.

macOS

Install the Xcode Command Line Tools so that clang++ and make exist:

xcode-select --install

Install Qt 5.15 or Qt 6. The Qt Open Source installer provides a macos kit. Homebrew users can install the current Qt 6 with brew install qt. Call the qmake from that kit, not a random qmake from an old prefix. The official installer puts it under Qt in your home folder, in the macos/bin directory of the kit; Homebrew puts it in the bin directory of the qt prefix.

The sources target macOS 12.3 or later. On Apple Silicon and Intel the project file requests a universal binary (arm64 and x86_64) when the Qt kit can link both architectures.

In the freeRouting folder:

qmake
make

or make -j8 on a multi-core Mac. The result is bin/freeRouting. This is a Unix-style executable, not a freeRouting.app bundle; start it from Terminal with ./bin/freeRouting. If macOS Gatekeeper blocks a binary you just built, allow it under Privacy & Security, or launch it from that same Terminal.

After a successful build

The program is ready to use on its own. Open a dsn file from the file dialog or pass the path on the command line. How to connect it to a CAD tool is described on the pages for LayoutEditor, KiCad and Eagle.

If qmake or make stops with an error, read the first error, not the last. Confirm qmake -v (or qmake6 -v) shows a supported Qt, that you are in the freeRouting folder that contains freeRouting.pro, and that the compiler belongs to the same kit as that qmake.