Compiling KiCad on Debian & Ubuntu
==================================

First written: 10-Mar-2009

Updated: 31-Oct-2009

Lasted edited by: Jerry Jacobs <xor.gate.engineering@gmail.com>

This file is AsciiDoc formatted to you can convert it to pdf/xhtml/xml

Ubuntu 9.10 (Karmic Koala)
--------------------------
After a fresh install you need the following packages to compile and run
KiCad from source.

Boost   - Collection of portable C++ source libraries
CMake   - Cross-platform make
Doxygen - Documentation system for several programming languages
GLUT    - The OpenGL Utility Library
wxGTK   - The wxWidgets GUI toolkit with GTK+ bindings
zlib    - General purpose data compression library

Because boost is in the repository of kicad you don't need to install them.

Install these with aptitude:
----
sudo aptitude install build-essential cmake doxygen subversion libglut3 libglut3-dev libwxgtk libwxgtk-dev zlib1g zlib1g-dev
----

Checkout the source
----
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad kicad
----

Generate makefiles
----
cd /home/<you>/<kicad-src-dir>
cmake .
----

Compile
----
make
----
*Note* on multicore systems you can do parallel make jobs to speed
up compiling by giving the option -j {JOBS} to make.

Ubuntu 9.04
-----------
Special thanks to David J S Briscoe <david@djsbriscoe.vispa.com>

The first thing I did was follow this page up to the running kicad section

http://basicubuntu.blogspot.com/2009/02/installing-kicad-on-ubuntu.html

This resulted in the error message detailed in this post

http://tech.groups.yahoo.com/group/kicad-devel/message/3180

SNIPPET

The build fails with the following message

----------------------------------------------------------:

david@ubuntu:~/Desktop/KICAD_SVN$ fakeroot debian/rules binary
test -d debian/patched || install -d debian/patched
dpatch apply-all
dpatch cat-all >>patch-stampT
mv -f patch-stampT patch-stamp
mkdir -p /home/david/Desktop/KICAD_SVN/build/kicad
mkdir -p /home/david/Desktop/KICAD_SVN/build/bitmaps
cd /home/david/Desktop/KICAD_SVN/build/kicad && cmake \

-DKICAD_DEMOS=/home/david/Desktop/KICAD_SVN/debian/kicad-common/usr/share/doc/ki\
cad/demos ../../kicad \
-DXPM_CPP_PATH=/home/david/Desktop/KICAD_SVN/build/bitmaps
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/libX11.so
-- Check for installed OpenGL -- found
-- Check for installed Boost -- not found
CMake Error at CMakeModules/CheckFindPackageResult.cmake:6 (message):
Boost was not found - it is required to build Kicad
Call Stack (most recent call first):
CMakeLists.txt:111 (check_find_package_result)


-- Configuring incomplete, errors occurred!
make: *** [configure-stamp] Error 1
david@ubuntu:~/Desktop/KICAD_SVN$

-----------------------------------------------------------------:


SNIPPET

The next step was to remove any libboost 1.34 libraries using the apt-get
remove command (can't remember the exact commands I used) as the Ubuntu 9.04
(Jaunty) repositories only had the 1.34 version available.

After this I installed the boost 1.37 libraries
using this command

---------------------------------------
sudo apt-get install libboost1.37-dev
---------------------------------------

This pulled down all the required files and dependencies (as far as I
know-how do I check this?)

I then entered the following command

---------------------------------------
fakeroot debian/rules binary
---------------------------------------

and everything was built properly (I saw a few warnings flash past-will
these be logged anywhere?)

I was left with a bunch of debian packaged files. I installed the main one,
the common one and an English language documentation one (I can supply more
details if needed later as I am not using Ubuntu at the moment).

The first link above describes moving the libraries and other files into the
same place as the compiled executables. I didn't do this, so I have a
duplicate installation.
The above method needs some fine tuning and improvements. If you can let me
know of a tidier way of compiling Kicad please let me know.
Maybe there is a way of automating things with scripts, my Linux knowledge
doesn't go that far, yet.


Ubuntu (8.04)
-------------
Original from:
http://basicubuntu.blogspot.com/2009/02/installing-kicad-on-ubuntu.html

Required software and dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We need to install the following packages: debhelper, dpatch, libx11-dev,
libglu1-mesa-dev, libgl1-mesa-dev, mesa-common-dev, libwxbase2.8-dev,
libwxgtk2.8-dev, libboost-dev, subversion, cmake (>= 2.6.0).

---------------------------------------
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
---------------------------------------

And finally, we need cmake, but we need atleast version 2.6, the one
from the repository is not the updated one (atleast for ubuntu 8.04).
You can download version 2.6 from newer ubuntu releases.
Just search for cmake on http://packages.ubuntu.com then get a newer
cmake .deb file and install the downloaded package on the console
with:

---------------------------------------
sudo dpkg -i <packagename.deb>
---------------------------------------

But if what the repository gives you is atleast version 2.6, then
simply

---------------------------------------
sudo apt-get install cmake
---------------------------------------

Get KiCad Sourcecode
~~~~~~~~~~~~~~~~~~~~
We will be getting the source codes through subversion. Create a directory
where you'll be downloading the source codes, and go to that
directory. type the following:

---------------------------------------
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad kicad
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad-doc kicad-doc
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad-library kicad-library
---------------------------------------

Also we need the following to get the debian specific stuff

---------------------------------------
svn checkout http://svn.flexserv.de/kicad/trunk/debian
---------------------------------------

Compiling
~~~~~~~~~
To compile simply do the following on your terminal (make sure you're still in
the same directory where you did the svn)

---------------------------------------
fakeroot debian/rules binary
---------------------------------------
hopefully, there will be no errors.
You'll find the compiled version of KiCad in the following directory:

---------------------------------------
debian/kicad/usr/bin/
---------------------------------------
to complete things up, you'll need to copy the following folders

---------------------------------------
debian/kicad-common/usr/share/kicad/library
debian/kicad-common/usr/share/kicad/modules
debian/kicad-common/usr/share/kicad/template
---------------------------------------
in here

---------------------------------------
debian/kicad/usr/share
---------------------------------------
again, to run KiCad go to

---------------------------------------
cd debian/kicad/usr/bin/
---------------------------------------
and double click KiCad


Debian squeeze (testing)
------------------------

Special Note
~~~~~~~~~~~~
After SVN trunk revision 1753 boost library 1.36 or higher is needed
to compile KiCad.

Installing Packages
~~~~~~~~~~~~~~~~~~~
The following packages should be installed with
synaptic, apt-get or aptitude:
- build-essential
- cmake
- libboost-dev
- libwxgtk2.8-dev
- libglut3-dev

The following packages will also be installed then
- cmake dependencies
- boost development dependencies
- wxwidgets development dependencies
- opengl3 (glut) development dependencies

Get KiCad sourcecode
~~~~~~~~~~~~~~~~~~~~
Checkout sourcecode using subversion or download latest release.

.*Subversion*
---------------------------------------
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad kicad
---------------------------------------

.*Release*
---------------------------------------
wget http://iut-tice.ujf-grenoble.fr/cao/kicad-sources-2009-02-16.tar.gz
tar -xvf kicad-sources-2009-02-16.tar.gz
---------------------------------------

Compiling
~~~~~~~~~
Run 'cmake .' in the root of the source directory then build the
binaries with 'make'.

Installing
~~~~~~~~~~
For installing you could use 'make install' or build a debian package.
