This set of documents describe how to build KiCad, especially the latest development version, on some Linux distributions without need for a list of dependencies.
We assume you are superficially familiar with these documents:
Hunting down all the tools and dependencies may be the biggest obstacle for a newcomer when building KiCad on Linux. There exists an easier way to do that. It depends on a generic feature of many Linux distributions: they use packaging systems and repositories so that it's possible to install all packages which are needed to build one package. If KiCad is packaged for a certain distribution it makes possible to install all build time dependencies with one command.
This is the generic workflow which should work for rpm based (Fedora, SuSE and all derivatives) and deb based (Debian, Ubuntu and all derivatives) distros:
- Have your distribution installed, nothing extra is needed. Also obtain the KiCad source code you want to build.
- Enable the repository which has the KiCad package. (Note that for .deb based distros the source repository, or at least making the sources available from the repository, is different than the normal repository, so having the repository from which you can install KiCad binaries isn't enough.)
- Use the distro specific command line command for installing build dependencies for the KiCad package.
- Configure the KiCad build with cmake.
- In case of configuration errors try to find out what may still be needed (use the official KiCad build documentation for that). Install the needed dependencies or possibly change the build configuration.
Step 4 may be needed if the packaged KiCad version is different than the source code you want to compile or if different build flags are used. If you compile the same KiCad version which is packaged and use the same build flags this shouldn't be needed. In any case most of the dependencies have already been installed and the rest is much easier.
The whole point of this procedure is to avoid trying to find each and every package which you must install to fulfill the tool and especially library dependencies which may be time consuming and frustrating. Even if a list of packages is available somewhere to copy it may become outdated when KiCad changes or the distro is updated.
If no KiCad package is available for your distro you can use the official KiCad build instructions.
Distro specific instructions
- In Mint use the Package Manager (Synaptic) to enable the source repo
- No nightly builds available for Debian 10 Buster. Too difficult with python3/phoenix, I give up...
- TODO: try with this repo: https://forum.kicad.info/t/nightly-builds-for-debian-buster-and-bullseye/27487
- Gentoo package uses python3 and wxPython, it might work for 5.99, too.
Configure the build
Configuring the build using cmake command line one-liner is easy as long as you can follow a simple example, but if you don't know how cmake works it's frustrating to try to reconfigure anything. Therefore I recommend either ccmake which often comes automatically with build dependencies, or cmake-gui which must be installed separately. The latter is a bit easier to use.
- From command line create a build directory if you don't have one. Enter it.
- Source and build directories should be now correct in the UI.
- Don't worry if you get an error. Read the messages and try to find out what it is, change the configuration if needed. First see in the distro specific instructions if you need to change something. Read also the official KiCad build docs again.
- In any case the Configure button must be clicked several times; next configuration phase depends on the previous one. When all is OK there are no red lines.
- Click Generate.
- Now you should be able to close the configurator; it has written the cmake configuration CMakeCache.txt in the build directory.
Recommended build flags
- OCE seems to have been replaced by OCC on many systems. If that's the case, disable OCE and choose OCC. This may become the default some time later.
- https://dev-docs.kicad.org/en/build/linux/ recommends RelWithDebInfo or Debug for CMAKE_BUILD_TYPE.
- For other flags see https://dev-docs.kicad.org/en/build/getting-started/ and https://dev-docs.kicad.org/en/build/compile-options/.
- If you want to install under something else than the default /usr/local, give the wanted CMAKE_INSTALL_PREFIX from the command line:
ccmake -DCMAKE_INSTALL_PREFIX=/opt/kicad <path-to-source>. Otherwise some installation paths aren't changed and files go to /usr/local.
make(or some other build tool, for example ninja if you have it and it was selected in the first configuration cycle instead of "Unix Makefiles").
sudo make install(or for example sudo ninja install). Sudo is needed if the install prefix is /usr/local/ because normal users can't write there.
It's possible that pcbnew can't be run out of the box because the system doesn't find all binary library .so files. In that case you may need to run ldconfig or set the library loading path in some other way. In a simple case run
and it just works. If it doesn't work, you may need to add the path where libkicad_3dsg.so has been installed (for example /usr/local/lib64/ or /usr/local/lib) to the library loader cache. Search documentation with for example "add library loading path" for your distribution and see
man ldconfig. If there's /etc/ld.so.conf.d/ directory in your system you can do something like
echo /usr/local/lib | sudo tee /etc/ld.so.conf.d/local_lib.conf
and then run ldconfig to add the library to the cache.
Now you can run KiCad from command line with just