Linux

Building KiCad on Linux

To perform a full build on Linux, run the following commands:

cd <your kicad source mirror>
mkdir -p build/release
mkdir -p build/debug               # Optional for debug build.
cd build/release
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        ../../
make
sudo make install

If the CMake configuration fails, determine the missing dependencies (see Dependencies) and install them on your system. By default, CMake sets the install path on Linux to /usr/local. Use the CMAKE_INSTALL_PREFIX option to specify a different install path.

We recommend using the RelWithDebInfo build type for personal release builds, as this will include debugging symbols that will give you more useful stack traces in case you encounter a crash.

Replace RelWithDebInfo with Debug for debug builds.

Dependencies

The distribution-specific packages that have to be installed to build KiCad can be found in the nightly package sources:

Tips and Tricks

Ninja

KiCad builds faster using the Ninja build system in place of make. To use Ninja, you can specify Ninja output on your CMake command line:

cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo ../../
ninja
sudo ninja install

Linker

Build speed will be further improved by using a linker different than the default BFD linker (ld), for example gold (fast), lld (faster), or mold (fastest). To change the linker, specify it by passing the -fuse-ld=<linker name> flag via the -DCMAKE_CXX_FLAGS CMake option:

cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS=-fuse-ld=lld ../../

GCC versions lower than 12.1.0 do not support -fuse-ld=mold. Read https://github.com/rui314/mold#how-to-use to learn how to use mold in that case.