Building KiCad 5.1.0 From Source – on Ubuntu 18.04

Reading Time: 5 minutes

I encountered quite a few issues compiling KiCad 5.1.0 from source that took me a few hours to debug (some spent napping while things compiled). The whole thing is in the end < 20 lines of bash commands, though compilation took me 2-3 hours.

Here’s a tried-and-true method to get it to install (I tested on a VM). You should probably go straight to “install kicad” section.

From the beginning: Virtualbox

To make sure these instructions worked for 18.04.2, I tested on a clean install inside VirtualBox. Here I write down instructions, since some steps were confusing to me when I used Virtualbox for the first time.

  1. Install virtualbox
    1. I forget which of these I used… either download and double-click the *.deb, from the links at the very top of the page
    2. Or follow the instructions add the PPA and install https://www.virtualbox.org/wiki/Linux_Downloads
  2. Download ubuntu 18.04.2 ISO from https://www.ubuntu.com/download/desktop
  3. Create new VM
    1. Machine > New…
    2. Go though — I used 2048 GB memory and 40 GB virtual (expandable) hard disk
  4. Install Ubuntu into the VM
    1.  Machine > Settings > Storage > Controller: IDE
      1. Click the “+” sign over the CD rom
      2. Choose Disk > Add > (then select your .iso file)
    2. Now click okay. We’re back to the main window — click the big green “Start” arrow.
    3. The VM starts up, and the standard “Install Ubuntu” screen should pop up once booted. Install Ubuntu as normal
      1. Make sure to click “Also install proprietary media” as otherwise “Virtualbox Guest Additions ISO” will later not run
  5. We probably want to copy-paste in commands. Thus, install Guest Additions. This already comes built-in to virtualbox, no need to download anything else
    1. Devices > Insert Guest Additions Add-on Image…
    2. Click “run” when pop-up prompts
      1. If nothing happens, try running from commandline
      2. If not, it’ll probably complain about gcc not being installed; run sudo apt install build-essential
    3. Restart sudo shutdown -r now
    4. Now enable clipboard
      1. Devices > Clipboard > Bidirectional
      2. Also, View > Auto-Resize Display should now work, but I turn it off because if you accidentally resize the window your VM could freeze alarmingly

Install KiCad

First let’s install dependencies

This last command will spit out an error — E: You must put some 'source' URIs in your sources.list — so go to “Software and Updates” and check the “Source Code” on the first tab.  Then again run build-dep, as well as install the other dependencies.

Install Ngspice from source

This was a pain to figure out, since it would compile for 10 minutes before failing. Basically, can’t skip independently installing the dependencies, even with the build-dep step above. Fortunately easy to install dependencies.

Note: Why not apt install?  If you just run sudo apt-get install ngspice, later during cmake it will complain about

Probably, there’s some symlink solution, but I’ve spent way too long on this already.

Then, install KiCad itself.

We follow http://docs.kicad-pcb.org/doxygen/md_Documentation_development_compiling.html

However, there are some issues (specific to 16.04+ I think) with  wxWidgets and wxPython you really don’t want to. Thus we change the cmake line to add options to ignore scripting and things that require wxWidgets / wxPython:

Now you should be able to run kicad from the commandline

Pops up a GUI kicad window!

Appendix

make clean

If something isn’t working that you think should, try clearing old files generated by make:

Note

Useful: You can see what other flags you can provide to cmake (using the -D flag), by peeking at kicad/build/release/CMakeCache.txt

Errors

These are some of the errors I ran into. If you see this, the solution to them is one of the lines above…

ngspice errors

 

A whole host of wx errors, solved by not using wx ^___^

Thanks

I figured most of this out from two forum posts:

https://bugs.launchpad.net/kicad/+bug/1804771

https://forum.kicad.info/t/wxpython-3-1-error-building-kicad-from-source-ubuntu-18-04/11431

[crayon-5d1279feabb06705292430/]

Note

Useful: You can see what other flags you can provide to cmake (using the -D flag), by peeking at kicad/build/release/CMakeCache.txt

[crayon-5d1279feabb07342991033/]

Errors

These are some of the errors I ran into. If you see this, the solution to them is one of the lines above…

ngspice errors

[crayon-5d1279feabb09268506344/]

 

A whole host of wx errors, solved by not using wx ^___^

[crayon-5d1279feabb0c601012606/] [crayon-5d1279feabb0e346242183/] [crayon-5d1279feabb11214648444/] [crayon-5d1279feabb13234469986/]

Thanks

I figured most of this out from two forum posts:

https://bugs.launchpad.net/kicad/+bug/1804771

https://forum.kicad.info/t/wxpython-3-1-error-building-kicad-from-source-ubuntu-18-04/11431

social medialulz

Facebooktwittergoogle_plusredditpinterestmail

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.