Skip to content

How to build Kicad on Ubuntu

by Layne on December 3, 2010

Final update: These directions are exceptionally out of date. Follow the official guide here: https://dev-docs.kicad.org/en/build/

Update: Looking to run the latest and greatest version of Kicad on your Ubuntu computer, but don’t want to mess about with compiling it yourself? Look no further, we’ve set up a PPA for Ubuntu with the newest Kicad automatically compiled each night.

Update 2: It looks like you need to install the “bzrtools” package now, to enable the “patch” command for bzr. Something along the lines of “sudo apt-get install bzrtools” should do the trick on a Debian-based distro. I updated the commands below to install bzrtools.

Wayne and Layne are big fans of Kicad, a suite of high-quality, open-source tools for designing circuit schematics and printed circuit boards. Since development is very active, with awesome updates nearly every day, we like to keep up-to-date with the most recent version. The best way to stay current is by building the software yourself from the source code in the repository. The official Kicad docs are a bit lacking in a complete guide on how to build Kicad from source using a modern Ubuntu Linux, so here is a quick guide we wrote up. This was tested on a fresh install of Ubuntu 10.10 on i386.

Please note that most people won’t need to follow this procedure in order to use Kicad. Prebuilt packages are available from most major Linux distributions, and installers are available for Windows and OSX. However, some people (like us) want to run kicad with brand new updates or contribute to the code. If that sounds like something you want to do, here’s how you do it.

The Kicad source code is stored in a Bazaar repository, so we need to install the bzr utility. We download the source code first, because it doesn’t have any tool requirements to download, and it also will take a while to download all that data:

sudo apt-get install bzr bzrtools
bzr checkout lp:kicad kicad.bzr

While that is running, open another terminal and start installing the necessary build tools:

sudo apt-get install build-essential checkinstall cmake doxygen zlib1g-dev
sudo apt-get build-dep kicad

You might also need to install the freeglut3 package for the OpenGL stuff.

sudo apt-get install freeglut3

Once the source code has downloaded and all the build tools are installed, go into the new source code directory:

cd kicad.bzr

To keep things cleaner, it’s suggested that you create a build directory for the build files:

mkdir build
cd build

Kicad uses the CMake tool, so we must run that first:

cmake -DKICAD_TESTING_VERSION=ON ../

CMake generates standard Makefiles, so we proceed in the usual way:

make

If you have multiple processor cores in your computer, you can do some of the work in parallel, by adding -j N to your make line. Replace N with the number of cores in your computer. My computer has four cores, so I used this command to more quickly build Kicad:

make -j 4

Once the build is finished, install the Kicad files:

sudo make install

Now, you can run kicad and check that everything is working.


Once a few days or weeks have passed and you want to get back up to date, start by updating your copy of the Kicad source code:

cd ~/kicad.bzr
bzr update

You probably want to remove all the old build files:

cd build
rm -rf *

Continue as before, for compiling and installing Kicad:

cmake -DKICAD_TESTING_VERSION=ON ../
make
sudo make install

We hope this guide was useful and accurate! If you run into any trouble, please leave a comment below and we’ll do our best to help you out.

If you want to also install the Kicad library of parts, you can use these commands:

bzr checkout lp:~kicad-lib-committers/kicad/library kicad-library.bzr
cd kicad-library.bzr/
mkdir build
cd build/
cmake ../
sudo make install

From → Uncategorized

20 Comments Leave one →
  1. Greg permalink

    Thanks for the great step-by-step procedures. The installation packages create the menu shortcuts. Is there a shell script to set those up the same as the pre-built packages? It’s a simple matter to just hand-create the launchers, but it would be nice if it could easily (and consistently) be done with a script.

  2. Had to install a virtual machine as I was having trouble with the mac build.

    Working through the code, you will need to sign up for Launchpad, if you haven’t before.

    and in the last code bunch I would remove the -j 4 in case some tries to copy it in the future with out going through the tutorial.

    thanks guys..

  3. Paul, thanks for the comments. I wasn’t aware that you needed to register for launchpad in order to checkout the source code. I’ll have to try it on a fresh linux VM to confirm, but thanks for the heads-up.

    Thanks also for the suggestion to remove the “-j 4” from the last code chunk. That’s a good point, and I have updated the post accordingly. Thanks!

  4. Christian permalink

    FYI, there is a PPA for a nightly build of KiCad here: https://launchpad.net/~paxer/+archive/ppa

    You can install it by:

    sudo add-apt-repository ppa:paxer/ppa
    sudo aptitude update && sudo aptitude safe-upgrade

    cheers

  5. Yea, actually you don’t need to sign into launchpad, it’s just a warning that pops up, and you can ignore it.

    Thanks for posting the library download bit that has been the most frustrating part of getting kicad up and running for me, very annoying.

  6. vincent permalink

    Mate,
    thanks a lot, this was exactly what I wanted.

    I successfully installed the newest kicad using synaptic in about 10 seconds.

    I think this shows what amazing tool synaptic is.

    Regards
    Vincent

  7. Prashant permalink

    I used to get this error “stty: standard input: Invalid argument” when “cmake” was executed in ubunutu. This problem was because there were two cmake binaries one in “/usr/bin/cmake” and another in “/usr/local/bin/cmake”. I had to rename the “/usr/local/bin/cmake” binary to something else since the right cmake is located in “/usr/bin/cmake”.

    You can find out the path of binary by executing “which cmake” and it should point to “/usr/bin/cmake”

  8. Hemal permalink

    Thank you. 🙂

  9. David Briscoe permalink

    Hi,
    Ive followed all the instructions above and get the following error about wxwidgets not being found (when giving the cmake -DKICAD_TESTING_VERSION=ON ../ command). I also had to install freeglut3 as it could not find OpenGL.
    I’m using Linux Mint 12 (julia)

    david@david-122-CK-NF68 ~/kicad.bzr/kicad-build $ cmake -DKICAD_TESTING_VERSION=ON ../
    Build testing (unstable) version of Kicad
    — Check for installed OpenGL — found
    — Check for installed wxWidgets — not found
    CMake Error at CMakeModules/CheckFindPackageResult.cmake:6 (message):
    wxWidgets was not found – it is required to build Kicad
    Call Stack (most recent call first):
    CMakeLists.txt:201 (check_find_package_result)

    — Configuring incomplete, errors occurred!
    david@david-122-CK-NF68 ~/kicad.bzr/kicad-build $

    How do I install the correct Wxwidgets sources using APT?
    Thanks.

    David,

  10. David Briscoe permalink

    Hi,
    I’ve installed libwxbase2.8-dev and libwxgtk2.8-dev using APT as I could not find the required 2.9.2 versions required. Is this why I get the not found messages below? I will continue with the build process and see what happens anyway.

    david@david-122-CK-NF68 ~/kicad.bzr/kicad-build $ cmake -DKICAD_TESTING_VERSION=ON ../
    Build testing (unstable) version of Kicad
    — Check for installed OpenGL — found
    — Check for installed wxWidgets — found
    — Looking for malloc.h
    — Looking for malloc.h – found
    — Looking for iso646.h
    — Looking for iso646.h – found
    — Looking for strcasecmp
    — Looking for strcasecmp – found
    — Looking for strncasecmp
    — Looking for strncasecmp – found
    — Looking for malloc
    — Looking for malloc – found
    — Looking for _stricmp
    — Looking for _stricmp – not found.
    — Looking for _strnicmp
    — Looking for _strnicmp – not found.
    — Looking for _snprintf
    — Looking for _snprintf – not found.
    — Looking for _hypot
    — Looking for _hypot – not found.
    — Bazaar version control system version found.
    — Kicad Bazaar build version: (2011-12-23 BZR 3325)
    — Found Doxygen: /usr/bin/doxygen
    — Configuring done
    — Generating done
    — Build files have been written to: /home/david/kicad.bzr/kicad-build
    david@david-122-CK-NF68 ~/kicad.bzr/kicad-build $

  11. David Briscoe permalink

    Hi,
    I also used the following command line

    sudo apt-get install debhelper dpatch libx11-dev libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot subversion libboost-serialization-dev

    or the packages can be instlled one at a time in Mint 12’s software manager as long as all the repositories are enabled.

    Kicad seems to have built OK. Just got to test everything out. Can some other people try it for me as well.
    Thanks.

    David.

  12. Thanks for this post. it is still helpfumm in august 2012
    🙂

  13. vincent permalink

    hi there,
    unfortunately this did not work for me. I am on a Debian 7, 64 bit

    this is the error I get

    # make
    Scanning dependencies of target boost
    [ 0%] Creating directories for ‘boost’
    [ 0%] Performing download step (download, verify and extract) for ‘boost’
    — downloading…
    src=’http://downloads.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.tar.bz2′
    dst=’/opt/kicad.bzr/.downloads-by-cmake/boost_1_53_0.tar.bz2′
    timeout=’none’
    — downloading… done
    — verifying file…
    file=’/opt/kicad.bzr/.downloads-by-cmake/boost_1_53_0.tar.bz2′
    — verifying file… done
    — extracting…
    src=’/opt/kicad.bzr/.downloads-by-cmake/boost_1_53_0.tar.bz2′
    dst=’/opt/kicad.bzr/.downloads-by-cmake/boost_1_53_0/src/boost’
    — extracting… [tar xfz]
    — extracting… [analysis]
    — extracting… [rename]
    — extracting… [clean up]
    — extracting… done
    [ 0%] creating ‘boost scratch repo’ specifically for boost to track boost patches
    [ 0%] adding pristine boost files to ‘boost scratch repo’
    [ 0%] committing pristine boost files to ‘boost scratch repo’
    [ 0%] Performing patch step for ‘boost’
    bzr: ERROR: unknown command “patch”
    make[2]: *** [../.downloads-by-cmake/boost_1_53_0/src/boost-stamp/boost-patch] Error 3
    make[1]: *** [CMakeFiles/boost.dir/all] Error 2
    make: *** [all] Error 2

  14. xyz permalink

    i get this when i type ” sudo make install ” y is that ??? and what is File to patch: ??
    [ 0%] Performing patch step for ‘boost’
    M boost/cstdint.hpp
    M boost/polygon/detail/minkowski.hpp
    M libs/context/build/Jamfile.v2
    – libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S
    – libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S
    patching file boost/polygon/detail/minkowski.hpp
    patching file boost/cstdint.hpp
    patching file libs/context/build/Jamfile.v2
    patching file libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S
    patching file libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S
    adding libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S
    adding libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S
    can’t find file to patch at input line 4
    Perhaps you used the wrong -p or –strip option?
    The text leading up to this was:
    ————————–
    |=== modified file ‘tools/build/v2/tools/gcc.jam’
    |— tools/build/v2/tools/gcc.jam 2013-12-29 13:13:00 +0000
    |+++ tools/build/v2/tools/gcc.jam 2013-12-29 14:36:31 +0000
    ————————–
    File to patch:

  15. Babar Malik permalink

    Hi,
    I have installed the build version of Kicad on Ubuntu, Can you plese tell me that how to launch it after installation?

  16. Hi, what do you mean by “build version”? Do you mean that you build it yourself from source code? Or installed the KiCad package version from the Ubuntu software center / apttitude / apt-get?

    If you build and install kicad from source (as outlined in this very-old article) then it may not add Kicad to the graphical launcher system. You probably need to open a terminal and run the “kicad” command to start Kicad. Hope this helps!

Trackbacks and Pingbacks

  1. A Cavalcade of KiCad Resources « Meat and Networking
  2. RobotGrrl.com » Blog Archive » Learning more CAD
  3. Kicad testing PPA packages for Ubuntu | Wayne and Layne
  4. The Amp Hour #83 — Aggravating Agersia Agiotage | The Amp Hour

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS