BlocNotes

Notepad of a tinker, maker, hacker or whatever you call it :)

How to compile KiCad 5.1.x for Debian 10

How to compile KiCad 5.1.x for Debian 10

I was looking to use InteractiveHtmlBom plugin for KiCad but unfortunately Debian maintainers did not set KICAD_SCRIPTING option in official package. After few failing attempts I even tested official flatpak package but it is an old version (currently 4.x) and scripting was not enabled too.

So I dug further until it actually succeed to compile :-)

Here is the thing: KiCad official documentation still recommend packages for python2, and v5.1.4 is not compatible with new versions of libglm-dev if compiled with GCC; this is now fixed in master. So the commands I used are:

# From http://kicad-pcb.org/download/debian/ without Python2 packages
apt install cmake doxygen libboost-context-dev \
  libboost-dev libboost-system-dev libboost-test-dev \
  libcairo2-dev libcurl4-openssl-dev libgl1-mesa-dev \
  libglew-dev libglm-dev libngspice-dev \
  liboce-foundation-dev liboce-ocaf-dev libssl-dev \
  libwxbase3.0-dev libwxgtk3.0-dev swig wx-common

# Add Debian Buster/Python3 required packages
apt install python3-wxgtk4.0 libwxgtk3.0-gtk3-dev \
  libboost-filesystem-dev python3-dev

# Add KiCad libraries
apt install kicad-libraries kicad-packages3d --no-install-recommends

# Downgrade libdlm-dev - For 5.1.4 or older only
apt remove libglm-dev
wget http://ftp.us.debian.org/debian/pool/main/g/glm/libglm-dev_0.9.8.3-3_all.deb
dpkg -i libglm-dev_0.9.8.3-3_all.deb

# Clone and build KiCad
git clone https://git.launchpad.net/kicad
mkdir -p kicad/build/release
cd kicad/build/release
cmake -DCMAKE_BUILD_TYPE=Release \
  -DKICAD_SCRIPTING_ACTION_MENU=ON \
  -DwxWidgets_CONFIG_OPTIONS="--toolkit=gtk3" \
  -DKICAD_SCRIPTING_WXPYTHON_PHOENIX=ON \
  -DKICAD_SCRIPTING_PYTHON3=ON \
  -DwxWidgets_CONFIG_EXECUTABLE='/usr/bin/wx-config' \
  ../..
make -j
make install

Now you can use InteractiveHtmlBom which is really pleasant for big boards !