Linux - Building and Packaging



Introduction

This page describes how to setup a build environment, using known supported Linux distributions:

  • Debian stretch and newer
  • Ubuntu trusty, xenial and newer
  • Fedora 23 and newer
  • Arch Linux

For other Linux distributions the instruction will be similar with the general requirements of Qt 5.5 or newer, OpenSceneGraph 3.2 or newer (if you want the build to include the PFD), osgEarth 2.7 (if you want the extra earth views).

For Linux Mint use the instructions for the Ubuntu or Debian distribution your version is based on.

In this page
 

Setup a build environment

Install all tools, dependencies, compiler and more which are needed for building:

Add the LibrePilot tools repository (Ubuntu trusty and xenial only)

(if the add-apt-repository command is not found: sudo apt-get install software-properties-common )

Ubuntu trusty and xenial
sudo add-apt-repository ppa:librepilot/tools -y
sudo apt-get update -q

Install the dependencies needed to build and run LibrePilot

Ubuntu trusty
sudo apt-get install build-essential curl ccache debhelper git-core git-doc flex graphviz bison libudev-dev libusb-1.0-0-dev libsdl1.2-dev python libopenscenegraph-dev qt56-meta-minimal qt56svg qt56script qt56serialport qt56multimedia qt56translations qt56tools qt56quickcontrols libosgearth-dev openscenegraph-plugin-osgearth
Debian and Ubuntu xenial or newer
sudo apt-get install build-essential curl ccache debhelper git-core git-doc flex graphviz bison libudev-dev libusb-1.0-0-dev libsdl1.2-dev python libopenscenegraph-dev qt5-default qttools5-dev-tools libqt5svg5-dev qtdeclarative5-dev qml-module-qtquick-controls libqt5serialport5-dev qtmultimedia5-dev qtscript5-dev libqt5opengl5-dev qml-module-qtquick-controls qml-module-qtquick-dialogs qml-module-qtquick-xmllistmodel qml-module-qtquick-localstorage qml-module-qtquick-particles2 qml-module-qtquick-window2 qml-module-qtquick2 libosgearth-dev openscenegraph-plugin-osgearth
Fedora
sudo dnf install curl libusbx-devel libGL-devel qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtmultimedia-devel qt5-qtquick1-devel qt5-qtscript-devel qt5-qtserialport-devel qt5-qtsvg-devel qt5-qttools-devel qt5-qttranslations OpenSceneGraph-devel dwz pkgconfig python osgearth-devel
Arch Linux
sudo pacman -S --needed base-devel curl libusb qt5-multimedia qt5-quickcontrols qt5-serialport qt5-svg sdl python2 qt5-tools openscenegraph
# install osgearth from the AUR
yaourt -Sa --needed osgearth qt5-quick1

For x86_64 architecture you still need 32bit glibc for ARM toolchain use or it fails silently!

Debian or Ubuntu
sudo apt-get install libc6-i386
Fedora
sudo dnf install glibc.i686
Arch Linux
sudo pacman -S --needed lib32-glibc

Get the code using Git

Choose/create a dir where you want LibrePilot code:

mkdir -p ~/code
cd ~/code

Checkout code :

git clone https://bitbucket.org/librepilot/librepilot.git

Change current directory to ~/code/librepilot:

cd ~/code/librepilot

Now you can checkout code from remote Git server:

git checkout next

Dev Tools Installation

Install development libraries and tools, these will be downloaded and automatically installed using root Makefile:

make build_sdk_install

Connecting your hardware

If you haven't got LibrePilot already installed you won't have permission to access to the hardware connected to USB port.

Copy the udev rules file to the right place and then re-plugin the USB device afterwards if it was already plugged in.

sudo cp package/linux/45-uav.rules /etc/udev/rules.d/45-uav.rules

Build

Take also a look to the Make Basics page.

Run software locally

make fw_resource
make gcs
build/librepilot-gcs_release/bin/librepilot-gcs

Package

Tip: set after make -j(numbers of cores/threads)

example: make -j4 package  ( for 4 cores/threads)

make package

Updating your local source of Librepilot

Go to the location where you have your source files ( if its the same as above it will be ~/code/librepilot )

The first command will get the new changes

The second command will rebuild 

git pull
make package