Install packages required for building from source

These instructions assume you have a pristine Debian installation, and you have made sure you have sudo rights. Do not build Machinekit as root.

If you have previously installed the machinekit runtime packages, make sure you have completely removed all of the runtime packages before you continue. To do so, execute sudo apt-get remove --purge machinekit .

Note that a previous LinuxCNC package install will conflict with building from source, so make sure LinuxCNC packages are removed by sudo apt-get remove --purge linuxcnc .

First, install supporting packages - note you must have configured the deb.machinekit.io apt repository already or the wrong package versions will be installed - see the instructions here to do so.

sudo apt-get install libczmq-dev python-zmq libjansson-dev pkg-config \
  libwebsockets-dev libxenomai-dev python-pyftpdlib cython bwidget lsb-release

If you are on Debian Wheezy then you need to add wheezy-backports in the package archive for cython 0.19:

sudo sh -c \
  "echo 'deb http://ftp.us.debian.org/debian wheezy-backports main' > \
  /etc/apt/sources.list.d/wheezy-backports.list"
sudo apt-get update
sudo apt-get install -t wheezy-backports cython

Get and build the source

sudo apt-get install git dpkg-dev
sudo apt-get install --no-install-recommends devscripts equivs
git clone https://github.com/machinekit/machinekit.git
cd machinekit
# to add RT-PREEMPT support, add a 'r'
# to add Xenomai support, add an 'x'
# this builds for Posix, RT-PREEMPT, Xenomai:
debian/configure -prx
sudo mk-build-deps -ir
cd src
./autogen.sh
# for the Beaglebone, add --with-platform-beaglebone to ./configure
# for the Raspberry2, add --with-platform-raspberry to ./configure
# for PC platforms, add --with-rt-preempt  --with-posix  --with-xenomai
./configure
make
sudo make setuid

# this script checks for missing configuration files
# and will give hints how to remedy:
../scripts/check-system-configuration.sh

If you wish to run this installation by default, add the next lines to your ~/.bashrc file, so that every new terminal is set up correctly for running Machinekit.

echo 'if [ -f ~/machinekit/scripts/rip-environment ]; then
    source ~/machinekit/scripts/rip-environment
    echo "Environment set up for running Machinekit"
fi' >> ~/.bashrc

However, if you are installing a RIP build onto a system that already has a version of Machinekit installed as a binary install from packages say, or has other RIP builds, you should invoke from the root dir of the RIP,

. ./scripts/rip-environment

only in terminal sessions where you specifically want to run this RIP.

Users who wish to invoke machinekit (built with xenomai threads enabled) on a xenomai realtime kernel must ensure they are members of the xenomai group. If that wasn’t already done when installing the kernel, then add each such user now

sudo adduser <username> xenomai

Logout and login again therafter.

Additional runtime packages you may need

Documentation

Documentation has been almost completely split from the machinekit build.

Drivers and components built with comp or instcomp, can still be configured to provide documentation for those items only using

./configure --enable-build-documentation

when building machinekit.

The complete documentation is available as below, so this option is only really of interest to developers writing components who wish to check the generated manual page for it.

This package will provide local copies of the manual pages and a man page stub to remind of how to use them.

sudo apt-get install machinekit-manual-pages

It is an optional install for users who wish to use a stand alone system or who have limited internet connectivity.

The same pages can be accessed here:
http://www.machinekit.io/docs/man/man1/ For information on utilities and GUIs
http://www.machinekit.io/docs/man/man3/ For information on the hal and rtapi APIs
http://www.machinekit.io/docs/man/man9/ For information on components and drivers

Additional runtime packages

The above steps outline only the build requirements. There might be some runtime support packages missing if machinekit was never installed before.

The easiest way to fetch all the machinekit runtime packages is to install a current package, and then delete it - the process pulls in all current runtime prerequisites:

sudo apt-get install machinekit
sudo apt-get remove --purge machinekit