Difference between revisions of "Installation/FromScratch"

From PaparazziUAV
Jump to navigation Jump to search
m (→‎IVY: https instead of http + new website)
 
(34 intermediate revisions by 4 users not shown)
Line 4: Line 4:
'''Users of recent Debian/Ubuntu distributions are advised to use the binary packages as described in [[Installation/Linux]].'''
'''Users of recent Debian/Ubuntu distributions are advised to use the binary packages as described in [[Installation/Linux]].'''


<span style="color:#FF0000">'''WARNING! This page is not quite up-to-date. Only use if you are proficient in working with Linux!'''</span>
<span style="color:#FF0000">'''WARNING! Only use if you are proficient in working with Linux!'''</span>


== Intro ==
== Intro ==


As with all Wiki pages, also this page is a work in progress. try to be a big help to the Paparazzi project and improve this page whenever you can. If you have a distribution different from Ubuntu which doesn't satisfy any other dependency and have instructions about compiling it, packaging it, feel free to add any reference on how to do that on this wikipage.
Users of other Linux flavors or anyone needing manual control of each individual package can install them independently. <br/>
The list of dependencies of the Debian package is located in the [https://github.com/paparazzi/paparazzi-portability-support/blob/master/debian/paparazzi-dev/debian/control <tt>debian/control</tt>] file and may help users of other distributions.
 
Some corresponding source tarballs can be downloaded from [https://launchpad.net/~paparazzi-uav/+archive/ppa/+packages paparazzi-uav ppa] on launchpad. (maybe building the packages from source is more reliable in view of dependencies)
 
For distributions using RPM packaging, the [http://packages.debian.org/unstable/source/alien alien] tool can be used to convert a .deb package into a .rpm package.
 
As with all Wiki pages, also this page is a work in progress. Try to be a big help to the Paparazzi project and improve this page whenever you can. If you have a distribution different from Ubuntu which doesn't satisfy any other dependency and have instructions about compiling it, packaging it, feel free to add any reference on how to do that on this wikipage.


== Goal ==
== Goal ==


The goal of this page is to clarify about which version of each piece of software has to be compiled, where to find that software, patches needed to make it compile on Linux. In our case 64bit Linux. This includes compiling all paparazzi-dev, paparazzi-arm-multilib software on your machine, running an Ubuntu Lucid Lynx or later Linux distribution or maybe even FreeBSD, or OSX.
The goal of this page is to clarify about which version of each piece of software has to be compiled, where to find that software, patches needed to make it compile on Linux, maybe even FreeBSD or OSX.
 
== Fedora 19  ==
 
To build paparazzi-uav on Fedora 19, you must install the next packages from the official repository:
* ocaml
* ocaml-findlib
* ocaml-xml-light
* ocaml-ocamlnet
* ocaml-lablgtk-devel
* libxml2-devel
* SDL-devel
* libusb-devel
 
Paparazzi-uav needs to include some ocaml headers when it compiles the simulator, then please be sure that they are included. If not, edit sw/simulator/Makefile and add:
 
  CAML_CFLAGS = -I/usr/lib64/ocaml
 
The following packages must be built from source code (they are not included in the official repository):
* ivy-c
* ivy-ocaml
 
Paparazzi-uav was successfully compiled using ivy-c 3.14 and ivy-ocaml 1.2. Please note that the ivy-c version is an unstable version!
 
Additionally, you need install the next RPMs to build ivy-c:
* pcre-devel
* libXt-devel
* tcl-devel
* glib2-devel
 
Don't forget to set the environment variable PKG_CONFIG before building ivy-ocaml, e.g:
 
  $ export PKG_CONFIG=/usr/local/lib/pkgconfig
 
== Fedora 24  ==
NOTE: Built upon Fedora 19 instruction, unnecessary instructions may occour.


== The shortcut ==
1. Install dependencies:
  $ sudo dnf install ocaml ocaml-findlib ocaml-xml-light ocaml-ocamlnet ocaml-lablgtk-devel ocaml-camlp4-devel libxml2-devel SDL-devel libusb-devel pcre-devel libXt-devel tcl-devel tk-devel glib2-devel gsl-devel


Maybe you are no so interested in the details at this moment and just want to quickly install. That's fine, for that we are working on a script and you only need to run one line to get everything installed. For this to work out you do need a working internet connection, but since you can read this text, that will probably not pose a problem.
2. Edit the PKG_CONFIG_PATH variable in your ~/.bashrc file to accomondate /usr/local/lib/pkgconfig/ (default for ivy libs)


$ cd ~ && wget http://openuas.org/pub/paparazzifromscratch.sh (still not ready and a work in progress)
3. Edit all the ivy specific .pc files in /usr/local/lib/pkgconfig, changing line 3 from "libdir=${exec_prefix}/lib" to "libdir=${exec_prefix}/lib64"


If you used the line above, and it all worked out you can stop reading now since everything is installed and compiled, ready for you to use.
4. Install ivy-python via pip and compile and istall ivy-c and ivy-ocaml from source as shown [[Installation/FromScratch#IVY]]


== Paparazzi-dev packages ==
Note: dependencies for compiling ivy-c and ivy-ocaml are already covered above (except toolchain!).


For Ubuntu users, you can install the following packages from standard repository. You can just copy the line(s) and paste into your terminal. But do not copy the $ sign, this symbol is just added on this page to show that it is to be pasted at a normal terminal prompt.
5. Compile and install [[JSBSim|JSBsim from source]]
 
Hacks: Link libivy and libJSBsim after compiling
  $ sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/lib
  $ sudo ln -s /opt/jsbsim/lib/libJSBSim.so.0 /usr/lib
  $ sudo ldconfig


=== Whole lot in one ===
== Arch Linux ==


  sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
This is a dirty hacked together (not really according to "the Arch Way") install, but works on a fresh installed Archbang GNU/Linux.
                      liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev libpcre-ocaml \
                      libpcre-ocaml-dev libgnomecanvas2-0 libgnomecanvas2-dev libglade2-0 libglade2-dev make build-essential \
                      git-core gnuplot boa m4 libtool libftdi-dev libmpfr-dev tcl8.5-dev xutils-dev tkdiff


=== Ocaml and libraries ===
'''NOTE: following issues '''
# Only written and tested for Archbang and Manjaro, not tested on vanilla Arch Linux yet.
# It seems that the error "unbound module GnoCanvas" can be resolved by installing lablgtk2 via yaourt first and then conf-gnomecanvas over opam.
# No symlink from liblglibivy.so.3 and liblglibivy.so.3 to libglibivy.so.3.15, so can't find these files.
# If pkg-config can't find some .pc files, a pkg-config path might not be set and exported properly. Use "pkg-config --variable pc_path pkg-config" to check if the path containing the ''ivy-c.pc'', ''ivy-glib.pc'' and ''ivy-tcl.pc'' files is found.
# "ocamlfind: Package `netclient' not found" -> seems that the opam packages need to be installed in a specific order... (try ocamlnet first, then lablgtk.2.16)


Ocaml, short for Objective Caml is the most popular variant of the Caml language. The Paparazzi Ground Control Station (GCS) and some of it's tools are crafted in this language.
'''Requirements:'''
# Up to date system
#* pacman -Syyu
# Install Yaourt
#*https://astrofloyd.wordpress.com/2015/01/17/installing-yaourt-on-arch-linux/


* ocaml, ocaml-camlimages-devel, ocaml-lablgtk2-devel, ocaml-xml-light-devel, ocamlnet-ocaml-devel
'''Install Paparazzi:'''
# Packages base-devel, yajl and general dependencies
#: <pre># pacman -S base-devel yajl subversion git libusb pcre ocaml camlp4 tcl tk python python-pip sdl glade</pre>
# Check if the PKG_CONFIG_PATH points to ''/usr/local/lib/pkgconfig'', otherwise set and export it
#: <pre>$ echo 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/' >> ~/.bashrc</pre>
# Build and install Ivy-C from Source
#: <pre>$ git clone https://gitlab.com/ivybus/ivy-c.git /home/$USER/temp/ivy-c &#10;$ cd /home/$USER/temp/ivy-c/src &#10;$ make &#10;$ sudo make install</pre>
# '''Dirty''' All the ivy libs are installed in ''/usr/local/lib64'' and not ''/usr/local/lib'' as the .pc files point to currently. <br/>
#:Change in the third line (libdir) in the ivy-c.pc, ivy-glib.pc and ivy-tcl.pc file from ''lib'' to ''lib64'' and the fourth line (includedir) from ''include'' to ''include/Ivy''
# '''Dirty'''For libgivy, libivy and libtclivy (.so and .so.3 ending) is a link directing to the lib with .so.3.15 availaible, but not for libglibivy. <br/>
#Create these links for libglibivy
#: <pre>$ sudo ln -s /usr/local/lib64/libglibivy.so.3.15 /usr/local/lib64/libglibivy.so &#10;$ sudo ln -s /usr/local/lib64/libglibivy.so.3.15 /usr/local/lib64/libglibivy.so.3</pre>
# Install opam (OCaml packet manager) via yaourt
#: <pre>$ yaourt -S opam</pre>
# Initialize opam
#: <pre>$ opam init &#10;$ f &#10;$ ~/.bashrc &#10;$ echo 'eval `opam config env`' >> ~/.bashrc</pre>
# Install and pin lablgtk.2.16.0 (2.18.0 will not work)
#: <pre>$ opam install -v lablgtk.2.16.0 &#10;$ opam pin add lablgtk 2.16.0</pre>
# Install OCaml packets via opam
#: <pre>$ opam install ocamlfind ocamlnet xml-light pcre ivy</pre>
#: If this fails at Ivy related parts check the notes on top of this guide.
# Install ivy-python via pip
#: <pre>$ sudo pip install ivy-python</pre>
# Install the Toolchain for Paparazzi (e.g. [https://aur.archlinux.org/packages/gcc-arm-none-eabi-bin/ gcc-arm-none-eabi-bin] from the AUR)
#: <pre>$ sudo pacman -S gcc-arm-none-eabi-bin</pre>


$ sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
Optional:
                        liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev


=== Gnome canvas Library ===
# Install flashing utilities if needed
$ yaourt stlink-git dfu-util
# Install [[JSBSim]] for [[NPS]]


The GnomeCanvas is an engine for structured graphics that offers a rich imaging model, high performance rendering, and a powerful, high level API. This widget can be used for flexible display of graphics and for creating interactive user interface elements.
[[Installation#Getting_the_Source_Code|Download]] and [[Installation#Launching_the_Software|build Paparazzi]]


$ sudo apt-get install libgnomecanvas2-0 libgnomecanvas2-dev
== Installing the Cross compiler toolchain ==


=== USB Library ===
There are currently two different toolchains available that can be used on Linux based systems with Paparazzi. For more information see [[Installation/Linux#ARM_embedded_toolchain]]


The libusb project aims to create a library for use by user level applications to access USB devices regardless of OS. http://www.libusb.org
== Installing OCaml packages using OPAM ==


  $ sudo apt-get install libusb-dev
One possibility to install and manage OCaml packages is [http://opam.ocamlpro.com/ OPAM (OCaml Package Manager)]:<br/>
'''Please first check the official [http://opam.ocaml.org/doc/Install.html OPAM install guide] for the simplest method.'''<br/>
To install it from the latest git tree run:
<nowiki>git clone https://github.com/OCamlPro/opam.git</nowiki>
cd opam
./configure && make
  sudo make install


=== Ocaml PCRE ===
opam init
eval `opam config env`


This OCaml-library interfaces the PCRE (Perl-compatibility regular expressions) C library. it can be used for matching regular expressions which are written in Perl style.
Update your shell environment as per opam init's instructions. E.g. add to your ''~/.profile'':
eval `opam config env`


  $ sudo apt-get install libpcre-ocaml libpcre-ocaml-dev
Build and install OCaml libs:
  opam install ocamlfind xml-light pcre ocamlnet
opam install -v lablgtk


=== Glade Library ===
== IVY ==


Libglade is a library that performs a similar job to the C source output routines in the GLADE user interface builder. Whereas GLADE's output routines create C source code that must be compiled, libglade builds the interface from an XML file (GLADE's save format) at runtime. This can allow modifying the user interface without recompiling.
IVY is a simple protocol and a set of open-source libraries and programs that allows applications to broadcast information through text messages, with a subscription mechanism based on regular expressions. The project can be found at: https://ivybus.gitlab.io/ 


$ sudo apt-get install libglade2-0 libglade2-dev
In the paparazzi project, Ivy is used to send telemetry data to where ever you want.


=== Tcl/Tk ===
NOTE: Do not confuse this IVY with the Apache Ivy project.


$ sudo apt-get install tcl8.5-dev
=== Ivy-python ===


Also the some utils are required to compile and  install Ivy.
The ivy-python package makes it possible to use the IVY libraries from within the Python programming language. The ivy-python package is architecture independent, so it can be downloaded from the Ubuntu or Debian paparazzi repository.


  $ sudo apt-get install xutils-dev
The easiest way to instally it on non Debian based systems is using [https://pip.pypa.io/ pip] to install the [https://pypi.python.org/pypi/ivy-python ivy-python package] from [https://pypi.python.org/pypi PyPi - the Python Package Index].
  pip install ivy-python


=== Make ===
Or install from the source repository via
git clone https://gitlab.com/ivybus/ivy-python.git
cd ivy-python
./setup.py install


GNU Make is an utility which controls the generation of executables and other target files of a program from the program's source files.
=== Ivy-c ===


$ sudo apt-get install make
To be able to use ivy-c, the libraries need to be installed.


=== Build essential ===
Required packages (Debian based):
* tk-dev
* libpcre3-dev
* libxt-dev
* pkg-config
* libglib2.0-dev


$ sudo apt-get install build-essential
Download source, compile and install libraries:


=== Libtool ===
# mkdir -p /opt/ivy-c
# cd /opt/ivy-c
# git clone https://gitlab.com/ivybus/ivy-c.git
# cd /opt/ivy-c/trunk/src
# make
# make install


GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface. Creating the files for Paparazzi software building becomes less cumbersome by using this tool.
It is possible you get errors of the test module when compiling, just ignore the messages, it is not important for the Paparazzi project. Contact the IVY team to help them also to resolve also the testing makefile issue.


$ sudo apt-get install libtool
==== troubleshooting ====


=== Git Client ===
Error message:
gcc -c -O2 -Wall -Wshadow -fPIC -I/usr/include/tcl8.4 -DTCL_CHANNEL_INTEGRATION  ivytcl.c
ivytcl.c:28:17: fatal error: tcl.h: No such file or directory


Git is a version control system. Version control systems allow many individuals to collaborate on the Paparazzi source code. This is needed to retrieve the latest sourcecode from various packages and Paparazzi sourcecode itself.
The Makefile cannot read the tcl-dev version you have installed and assumes that version 8.4 is installed, but can't find the appropriate folder.<br/>
Edit the line 57 of the Makefile from TCLVERS=8.4 according to your installed version, or just delete the 8.4, both work.


$ sudo apt-get install git-core


=== GNU Plot ===
Can't find 64bit libs:
Your ivy libs were probably installed to /usr/local/lib64 and you have to make symbolic links so that they will be found:
$ sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/lib
or
sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/local/lib


A command-line driven interactive plotting program. Unknow if it is used
$ sudo apt-get install gnuplot


=== TKDiff ===
=== Ivy-OCaml ===


TKDiff is a graphical front end to the diff program. It provides a side-by-side view of the differences between two files. It is used by the Paparazzi Center when configuration changes are not yet saved and the option comes along where one either can keep or view changes made in aircraft- and other configuration files.
ivy-ocaml provides OCaml bindings for ivy-c and is needed for most of the ground segment agents that are written in OCaml like [[Server]] and [[GCS]].


$ sudo apt-get install tkdiff
Download source, compile and install libraries:


=== FTDI library ===
# mkdir -p /opt/ivy-ocaml
# cd /opt/ivy-ocaml
# git clone https://gitlab.com/ivybus/ivy-ocaml.git
# cd /opt/ivy-ocaml/trunk
# make
# make install


libftdi is a library that talks to FTDI's 232 type chips, including the popular bitbang mode, using libusb. A library to be able to use with a debugging Autopilot hardware boards.
==== ivy-ocaml via OPAM ====
Or use OPAM: While the source repository and debian package is named ''ivy-ocaml'', in OPAM it is only named ''ivy'' (since it is obviously for OCaml).


  $ sudo apt-get install libftdi-dev
  $ opam update
$ opam install ivy


=== MPFR library ===
== LPC21ISP ==


The MPFR library is a C library for multiple-precision floating-point computations with correct rounding. MPFR is based on the GMP multiple-precision library. The main goal of MPFR is to provide a library for multiple-precision floating-point computation which is both efficient and has a well-defined semantics.
lpc21isp is only needed to serially flash the LPC2148 based autopilots (e.g. [[Lpc21BootloaderUpload bootloader]] for tiny, twog, umarim). LPC21ISP is an in-circuit programming (ISP) tool for the microcontroller used on the Paparazzi autopilot boards. The lpc21isp project is hosted on sourceforge and one can find the source packages and information at http://sourceforge.net/projects/lpc21isp/


  $ sudo apt-get install libmpfr-dev
Get the SVN version via
  $ mkdir -p /opt/lpc21isp
$ cd /opt/lpc21isp
$ svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp lpc21


=== ImageMagick ===
To compile go into the source directory and then do


ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. Being able to modify image based map pictures is a feature that may come in handy one time.
$ cd lpc21
$ make -f Makefile clean all


$ sudo apt-get install imagemagick
To install


=== Optional on an older OS ===
$ exportline="PATH=$PATH:/opt/lpc21isp"
$ if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
$ source ~/.profile


If you have an older OS distribution it never hurts to install the following...
== Paparazzi-dev Debian/Ubuntu packages ==


$ sudo apt-get install libx11-6 libx11-dev texinfo libncurses5 libncursesw5 libncursesw5-dev zlibc
For Ubuntu users, you can install the following packages from standard repository. You can just copy the line(s) and paste into your terminal. But do not copy the $ sign, this symbol is just added on this page to show that it is to be pasted at a normal terminal prompt.


=== Packages needed for cross compiling ===
=== Whole lot in one ===


If you don't already have them installed run
  sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
$ sudo apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential
                      liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev libpcre-ocaml \
                      libpcre-ocaml-dev libgnomecanvas2-0 libgnomecanvas2-dev libglade2-0 libglade2-dev make build-essential \
                      git gnuplot m4 libtool libftdi-dev libmpfr-dev tcl8.5-dev xutils-dev


=== Ocaml and libraries ===


== Building the Cross compiler toolchain ==
Ocaml, short for Objective Caml is the most popular variant of the Caml language. The Paparazzi Ground Control Station (GCS) and some of it's tools are crafted in this language.


The goal of this part is to building an ARM and STM32 cross-toolchain with binutils gcc newlib and gdb from source. This is needed so we can compile the code that ends up onto the autopilot board. Newlib is a C library intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products. Enter the following on your command prompt
* ocaml, ocaml-camlimages-devel, ocaml-lablgtk2-devel, ocaml-xml-light-devel, ocamlnet-ocaml-devel


  $ cd ~
  $ sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
$ nano paparazzi_from_scratch.sh
                        liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev


Then copy the part below (CTRL+C) and go to your terminal window again and use CTRL+SHIFT+V to paste the text into the nano editor. Afterther save the file with CTRL+X and answer Y
=== Gnome canvas Library ===


#!/bin/sh
The GnomeCanvas is an engine for structured graphics that offers a rich imaging model, high performance rendering, and a powerful, high level API. This widget can be used for flexible display of graphics and for creating interactive user interface elements.
 
# ******************************************************************************
  $ sudo apt-get install libgnomecanvas2-0 libgnomecanvas2-dev
#
# Goal: Get the ARM and STM32 cross compilers, tools and libraries installed and all
#      working on 64Bit (Linux) computer system like they should
# Version:  1.7
# Copyright: 2011 LGPL OpenUAS http://www.openuas.org/
# Date: 20110225 14:01
# Usage: $ sh ./paparazzi_from_scratch.sh 2>&1 | tee buildlog.txt 
#       
# I want to improve this script, what can I do?
#
#  IMPR: Add STM32 support
#  IMPR: with automatic log filename appending date like "date +%y%j%H%M%S"
#  IMPR: Set MAJOR and MINOR GCC version in make parameter automatically
#  IMPR: Add all commands from this wikipage also to the script, so we have a
#        full paparazzi from scratch in one script!
#
# Useful links:
# http://fun-tech.se/stm32/gcc/index.php
# http://only.mawhrin.net/~alexey/prg/lpc2103/toolchain/
# http://gcc.gnu.org/install/configure.html
# http://wiki.ubuntuusers.de/GNU_arm-toolchain
# http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/ARM-Options.html#ARM-Options
# http://www.hermann-uwe.de/blog/building-an-arm-cross-toolchain-with-binutils-gcc-newlib-and-gdb-from-source
# http://mcuprogramming.com/forum/arm/gnu-arm-toolchain-installer/
# http://code.google.com/p/hobbycode/source/browse/trunk/gnu-arm-installer
# http://www.ethernut.de/en/documents/cross-toolchain-osx.html
# http://paparazzi.enac.fr/w/index.php?title=User:Roirodriguez
# http://chdk.wikia.com/wiki/Gcc433
# http://chdk.wikia.com/wiki/Compiling_CHDK_under_Linux
#
# http://gcc.gnu.org/faq.html#multiple
# https://wiki.kubuntu.org/CompilerFlags
#
# Older compiler http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=91596
# Replaced O_CREAT for S_IRWXU in the files where you get gcc-3.4.4/gcc/collect2.c
#
# The eBook "Definitive guide to GCC" may come in handy
#
# And if all went well, a command
#  $ arm-elf-gcc -print-multi-lib
#
# Should give the following
#
# .;
# thumb;@mthumb
# interwork;@mthumb-interwork
# thumb/interwork;@mthumb@mthumb-interwork
#
# ******************************************************************************
# In case you want to recompile, and if you do not want to re-download the files
# to save time and bandwith set CLEANUPDOWNLOADS to N
CLEANUPDOWNLOADS="N"
TARGET=arm-elf  #Or use  TARGET=arm-none-eabi or arm_non_eabi the pararazzi makefile will figure it out
PREFIX=$HOME/arm-elf-paparazzi # Install location of the final toolchain, change this to your liking
# If you have a good reason to compile other versions, ONLY then change the version data below
BINUTILS_VERSION=2.16.1
GCC_VERSION=3.4.4
NEWLIB_VERSION=1.13.0
GDB_VERSION=6.8
#Just in case for some reason you want the latest versions a just values here
# and some more 3.4 in the rest of the script
#TARGET=arm-elf
#PREFIX=$HOME/arm-elf-latest # Install location of the final toolchain, change this to your liking
#BINUTILS_VERSION=2.20.1
#GCC_VERSION=4.4.4
#NEWLIB_VERSION=1.18.0
#GDB_VERSION=7.1
# ******************************************************************************
# * No need to change anything below this line, exept improvements            *
# ******************************************************************************
# On multicore Processor this value can speedup the compilation
if grep -q "processor" /proc/cpuinfo || grep -q "siblings" /proc/cpuinfo
then
  SPEEDUPCOMPILATION="-j "$(($( grep "processor" /proc/cpuinfo | sort -u | wc -l ) * $( grep "siblings" /proc/cpuinfo | tail -1 | cut -d: -f2 )))
else
  SPEEDUPCOMPILATION=""
fi
# Install texinfo tool
sudo apt-get install texinfo
# A GCC v3.4 64Bit install to avoid issues whil compiling the crosscompiler, native compile use would be much better
# Or, get debian packages from here http://www.openuas.org/pub/ubuntu/pool/universe/g/gcc-3.4/ or http://es.archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/
wget -N -c http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/gcc-3.4-base_3.4.6-8ubuntu2_amd64.deb
wget -N -c http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/cpp-3.4_3.4.6-8ubuntu2_amd64.deb
wget -N -c http://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-3.4/gcc-3.4_3.4.6-8ubuntu2_amd64.deb
# Must be installed in this order
sudo dpkg -i gcc-3.4-base_3.4.6-8ubuntu2_amd64.deb
sudo dpkg -i cpp-3.4_3.4.6-8ubuntu2_amd64.deb
sudo dpkg -i gcc-3.4_3.4.6-8ubuntu2_amd64.deb
if [ "${CLEANUPDOWNLOADS}" != "N" ]
then
  rm *.deb
fi
BINUTILS=binutils-$BINUTILS_VERSION
GCC=gcc-$GCC_VERSION
NEWLIB=newlib-$NEWLIB_VERSION
GDB=gdb-$GDB_VERSION
mkdir $PREFIX
# ** Now set the gcc and tools to be used in environment
echo 'export PATH='$PREFIX'/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
rm -drf build
mkdir build
# Get and compile the BinUtils
wget -N -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
tar xfvj $BINUTILS.tar.bz2
cd build
unset CFLAGS && unset LDFLAGS && unset CPPFLAGS && unset CXXFLAGS &&
CC=gcc-3.4
CXX=g++-3.4
../$BINUTILS/configure -v --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=$TARGET
make $SPEEDUPCOMPILATION CC=gcc-3.4 CXX=g++-3.4
make CC=gcc-3.4 CXX=g++-3.4 install
cd ..
rm -rf build/* $BINUTILS
if [ "${CLEANUPDOWNLOADS}" != "N" ]
then
  rm $BINUTILS.tar.bz2
fi
# ** Get and compile GCC stuff
wget -N -c ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.bz2
tar xfvj $GCC.tar.bz2
# Set correct MULTILIB options in GCC config, by patching
ONTHFLYPATCHFILE='gcc_thumb_interwork_settings.patch'
rm -f $ONTHFLYPATCHFILE #Just to make sure
echo '--- t-arm-elf 2003-09-30 12:21:41.000000000 +0200' >> $ONTHFLYPATCHFILE
echo '+++ t-arm-elf 2010-08-07 19:17:47.000000000 +0200' >> $ONTHFLYPATCHFILE
echo '@@ -26,8 +26,8 @@' >> $ONTHFLYPATCHFILE
echo ' # MULTILIB_DIRNAMES  += 32bit 26bit' >> $ONTHFLYPATCHFILE
echo ' # MULTILIB_EXCEPTIONS += *mthumb/*mapcs-26*' >> $ONTHFLYPATCHFILE
echo ' # ' >> $ONTHFLYPATCHFILE
echo '-# MULTILIB_OPTIONS    += mno-thumb-interwork/mthumb-interwork' >> $ONTHFLYPATCHFILE
echo '-# MULTILIB_DIRNAMES  += normal interwork' >> $ONTHFLYPATCHFILE
echo '+MULTILIB_OPTIONS    += mno-thumb-interwork/mthumb-interwork' >> $ONTHFLYPATCHFILE
echo '+MULTILIB_DIRNAMES  += normal interwork' >> $ONTHFLYPATCHFILE
echo ' # MULTILIB_EXCEPTIONS += *mapcs-26/*mthumb-interwork*' >> $ONTHFLYPATCHFILE
echo ' # ' >> $ONTHFLYPATCHFILE
echo ' # MULTILIB_OPTIONS    += fno-leading-underscore/fleading-underscore' >> $ONTHFLYPATCHFILE
patch $GCC/gcc/config/arm/t-arm-elf < $ONTHFLYPATCHFILE
rm -f $ONTHFLYPATCHFILE
cd build
# IMPR "../$GCC/gcc/collect2.c" ajust the line in this file to prevent compiler error for older gcc to "redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, S_IRWXU);"
unset CFLAGS && unset LDFLAGS && unset CPPFLAGS && unset CXXFLAGS &&
CC=gcc-3.4
CXX=g++-3.4
  ../$GCC/configure -v --enable-languages=c --prefix=$PREFIX --infodir=$PREFIX"/share/info" --mandir=$PREFIX"/share/man" --enable-interwork --enable-multilib --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=$TARGET
make $SPEEDUPCOMPILATION CC=gcc-3.4 CXX=g++-3.4  all
make CC=gcc-3.4 CXX=g++-3.4 install
cd ..
# NOTE: We do not delete GCC temporary build yet, we need it once more later in this script
if [ "${CLEANUPDOWNLOADS}" != "N" ]
then
  rm $GCC.tar.bz2
fi
# Now get and compile NewLib, note that sometimes this server is to busy serving the files,
# try to get the files via an FTP client with good resume if it happens
wget -N -c --waitretry=20 http://www.openuas.org/pub/newlib/$NEWLIB.tar.gz
tar xfvz $NEWLIB.tar.gz
cd build
unset CFLAGS && unset LDFLAGS && unset CPPFLAGS && unset CXXFLAGS &&
CC=gcc-3.4
CXX=g++-3.4
../$NEWLIB/configure -v --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --build=x86_64-linux-gnu --host=x86_64-linux-gnu
make $SPEEDUPCOMPILATION CC=gcc-3.4 CXX=g++-3.4
make CC=gcc-3.4 CXX=g++-3.4  install
cd ..
rm -rf build/* $NEWLIB
if [ "${CLEANUPDOWNLOADS}" != "N" ]
then
  rm -rf $NEWLIB.tar.gz
fi
# GCC needs to be build again including the real newlib now
cd build
unset CFLAGS && unset LDFLAGS && unset CPPFLAGS && unset CXXFLAGS &&
CC=gcc-3.4
CXX=g++-3.4
../$GCC/configure -v --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --enable-languages="c,c++" --with-newlib --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --build=x86_64-linux-gnu --host=x86_64-linux-gnu --infodir=$PREFIX"/share/info" --mandir=$PREFIX"/share/man"
make $SPEEDUPCOMPILATION CC=gcc-3.4 CXX=g++-3.4 all-gcc
make CC=gcc-3.4 CXX=g++-3.4 install-gcc
cd ..
rm -rf build/* $GCC
rm -rf build
# We need a symlink to arm-elf-gcc in /usr/bin/ the way the current paparazzi AP compile script works
# We need a better solution here then symlinks, any clues...plz improve
# Yes, helping with a better use of shell by using arm-elf wild-cards is appreciated
PREFIXBINDIR=$PREFIX/bin
OURBINDIR=/usr/bin
#Remove old symlinks
for x in $OURBINDIR/arm-elf*; do if [ -L $x ]; then sudo rm $x; fi ; done
#Make fresh symlinks so arm tools ar found by paparazzi center
sudo ln -s $PREFIXBINDIR/arm-elf-gcc $OURBINDIR/arm-elf-gcc
sudo ln -s $PREFIXBINDIR/arm-elf-size $OURBINDIR/arm-elf-size
sudo ln -s $PREFIXBINDIR/arm-elf-objcopy $OURBINDIR/arm-elf-objcopy
sudo ln -s $PREFIXBINDIR/arm-elf-objdump $OURBINDIR/arm-elf-objdump
sudo ln -s $PREFIXBINDIR/arm-elf-nm $OURBINDIR/arm-elf-nm
sudo ln -s $PREFIXBINDIR/arm-elf-addr2line $OURBINDIR/arm-elf-addr2line
sudo ln -s $PREFIXBINDIR/arm-elf-ar $OURBINDIR/arm-elf-ar
sudo ln -s $PREFIXBINDIR/arm-elf-as $OURBINDIR/arm-elf-as
sudo ln -s $PREFIXBINDIR/arm-elf-c++filt $OURBINDIR/arm-elf-c++filt
sudo ln -s $PREFIXBINDIR/arm-elf-cpp $OURBINDIR/arm-elf-cpp
sudo ln -s $PREFIXBINDIR/arm-elf-gcc $OURBINDIR/arm-elf-gcc
sudo ln -s $PREFIXBINDIR/arm-elf-gcc-3.4.4 $OURBINDIR/arm-elf-gcc-3.4.4
sudo ln -s $PREFIXBINDIR/arm-elf-gccbug $OURBINDIR/arm-elf-gccbug
sudo ln -s $PREFIXBINDIR/arm-elf-gcov $OURBINDIR/arm-elf-gcov
sudo ln -s $PREFIXBINDIR/arm-elf-ld $OURBINDIR/arm-elf-ld
sudo ln -s $PREFIXBINDIR/arm-elf-nm $OURBINDIR/arm-elf-nm
sudo ln -s $PREFIXBINDIR/arm-elf-objcopy $OURBINDIR/arm-elf-objcopy
sudo ln -s $PREFIXBINDIR/arm-elf-objdump $OURBINDIR/arm-elf-objdump
sudo ln -s $PREFIXBINDIR/arm-elf-ranlib $OURBINDIR/arm-elf-ranlib
sudo ln -s $PREFIXBINDIR/arm-elf-readelf $OURBINDIR/arm-elf-readelf
sudo ln -s $PREFIXBINDIR/arm-elf-size $OURBINDIR/arm-elf-size
sudo ln -s $PREFIXBINDIR/arm-elf-strings $OURBINDIR/arm-elf-strings
sudo ln -s $PREFIXBINDIR/arm-elf-strip $OURBINDIR/arm-elf-strip
# If you also a want to add the debugger, Uncomen the lines here. Configure could need parameter "--disable-werror" in some cases
#wget -N -c ftp://ftp.gnu.org/gnu/gdb/$GDB.tar.bz2
#tar xfvj $GDB.tar.bz2
#cd build
#../$GDB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib
#make $SPEEDUPCOMPILATION
#make install
#cd ..
#rm -rf build $GDB
#if [ "${CLEANUPDOWNLOADS}" != "N" ]
#then
#  rm $GDB.tar.bz2
#fi
echo "Misterious as this scripts progress might have looked, everything is now done, hopefully without any issue"


Then run the script in a terminal window via:
=== USB Library ===


$ sh ./paparazzi_from_scratch.sh 2>&1 | tee buildlog.txt
The libusb project aims to create a library for use by user level applications to access USB devices regardless of OS. [http://www.libusb.org]


== Rest of code needed ==
$ sudo apt-get install libusb-dev


To install the rest we make a special directory "develop". You can give it another name ofcourse.
=== Ocaml PCRE ===


$ mkdir ~/develop
This OCaml-library interfaces the PCRE (Perl-compatibility regular expressions) C library. it can be used for matching regular expressions which are written in Perl style.


== LPC21ISP ==
$ sudo apt-get install libpcre-ocaml libpcre-ocaml-dev


To get the software onto the main autopilot board a special tool is needed. We will use the great open-source LPC21ISP application. LPC21ISP is an in-circuit programming (ISP) tool for the microcontroller used on the Paparazzi autopilot boards. The lpc21isp project is hosted on sourceforge and one can find the source packages and information at http://sourceforge.net/projects/lpc21isp/
=== Glade Library ===


Get the SVN version via
Libglade is a library that performs a similar job to the C source output routines in the GLADE user interface builder. Whereas GLADE's output routines create C source code that must be compiled, libglade builds the interface from an XML file (GLADE's save format) at runtime. This can allow modifying the user interface without recompiling.
$ mkdir -p ~/develop/lpc21isp
$ cd ~/develop/lpc21isp
$ svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp lpc21


To compile go into the source directory and then do
$ sudo apt-get install libglade2-0 libglade2-dev


$ cd lpc21
=== Tcl/Tk ===
$ make -f Makefile clean all


To install
$ sudo apt-get install tcl-dev


  $ sudo cp lpc21isp /usr/bin/
Also the some utils are required to compile and install Ivy.


== IVY ==
  $ sudo apt-get install xutils-dev


IVY is a simple protocol and a set of open-source libraries and programs that allows applications to broadcast information through text messages, with a subscription mechanism based on regular expressions. The project can be found at: http://www.eei.cena.fr/products/ivy/ 
=== Make ===


In the paparazzi project, Ivy is used to send telemetry data to where ever you want.
GNU Make is an utility which controls the generation of executables and other target files of a program from the program's source files.  


NOTE: Do not confuse this IVY with the Apache Ivy project.
$ sudo apt-get install make


=== Ivy-python ===
=== Build essential ===


The ivy-python package makes it possible to use the IVY libraries from within the Python programming language. The ivy-python package is architecture independent, so it can be downloaded from the Ubuntu or Debian paparazzi repository. However since this is the from scratch page we will download it from the official source repository via
  $ sudo apt-get install build-essential
  $ mkdir -p ~/develop/ivy-python/
$ cd ~/develop/ivy-python/
$ svn co https://svn.tls.cena.fr/svn/ivy/ivy-python/trunk


Now we can build and install
=== Libtool ===
/!\ Only works with Python 2 /!\


$ cd ~/develop/ivy-python/trunk
GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface. Creating the files for Paparazzi software building becomes less cumbersome by using this tool.
$ sudo ./setup.py install


=== Ivy-c ===
$ sudo apt-get install libtool


To be able to use IVY-c, the libraries need to be installed. Source packages of ivy-c can be downloaded via:
=== libpcre3-dev ===


$ mkdir -p ~/develop/ivy-c
Required for compiling Ivy-C.
$ cd ~/develop/ivy-c
$ svn co https://svn.tls.cena.fr/svn/ivy/ivy-c/trunk


To compile
$ apt-get install libpcre3-dev


$ cd ~/develop/ivy-c/trunk/src
=== Git Client ===
$ make


It is possible you get errors of the test module when compiling, just ignore the messages, it is not important for the Paparazzi project. Contact the IVY team to help them also to resolve also the testing makefile issue.
Git is a version control system. Version control systems allow many individuals to collaborate on the Paparazzi source code. This is needed to retrieve the latest sourcecode from various packages and Paparazzi sourcecode itself.


Now install the compiled libraries
$ sudo apt-get install git


$ sudo make install
=== Subversion ===


If you have a 64bit system your ivy libs were probably installed to /usr/local/lib64 and you have to make symbolic links so that they will be found:
Version control system, required for cloning the ivy packages.
$ sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/lib


or
$ apt-get install subversion


$ sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/local/lib
=== GNU Plot ===


A command-line driven interactive plotting program. Unknow if it is used
$ sudo apt-get install gnuplot


If you get an error relating to ivytestready.c, make the following changes:
=== Meld ===
$ mkdir ~/develop/ivy-c/trunk/tools/Ivy
$ cd ~/develop/ivy-c/trunk/tools/Ivy
$ cp ../../src/ivy.h .
$ cp ../../src/ivyloop.h .
$ cp ../../src/ivysocket.h .
$ cp ../../src/timer.h .
$ cd ~/develop/ivy-c/trunk/src
$ make
This copies files from the src directory to the Ivy folder in tools which did not appear after running svn above.


=== Ivy-OCAML ===
Meld is a graphical front end to the diff program. It provides a side-by-side view of the differences between two files. It is used by the Paparazzi Center when configuration changes are not yet saved and the option comes along where one either can keep or view changes made in aircraft- and other configuration files.


The Ivy-ocaml is a Library that make it possible to use Ivy via the Ocaml language.
$ sudo apt-get install meld


$ mkdir -p ~/develop/ivy-ocaml
=== FTDI library ===
$ cd ~/develop/ivy-ocaml/
$ svn co http://svn.tls.cena.fr/svn/ivy/ivy-ocaml/trunk


Now we need to compile the source via
libftdi is a library that talks to FTDI's 232 type chips, including the popular bitbang mode, using libusb. A library to be able to use with a debugging Autopilot hardware boards.


  $ cd ~/develop/ivy-ocaml/trunk
  $ sudo apt-get install libftdi-dev
$ make
$ sudo make install


=== MPFR library ===


NOTE: If the above SVN repository does not work due to API incompatibilities get the ivy-ocaml source via
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding. MPFR is based on the GMP multiple-precision library. The main goal of MPFR is to provide a library for multiple-precision floating-point computation which is both efficient and has a well-defined semantics.


  $ wget http://paparazzi.enac.fr/ubuntu/dists/natty/main/binary-i386/ivy-ocaml_1.1-12.tar.gz
  $ sudo apt-get install libmpfr-dev


If you are running Ubuntu use the wget method listed above. Then run
=== ImageMagick ===


$ tar -zxvf ivy-ocaml_1.1-12.tar.gz
ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. Being able to modify image based map pictures is a feature that may come in handy one time.
$ cd ivy
$ make
$ sudo make install


== Paparazzi Main sourcecode ==
$ sudo apt-get install imagemagick
See the main [[installation]] page


TIP:
=== Optional on an older OS ===
If you get the File "pprz.mli", line 149, characters 78-89: Error: Unbound type constructor Ivy.binding
...this happens when IVY libraries are not yet installed. How to do this, read the part on installing IVY on this page


== The depriciated -mapcs-32 option ==
If you have an older OS distribution it never hurts to install the following...


The option "-mapcs-32" is only available with very old tool chain versions e.g. GCC-3.3.x. More recent tool chains will either require "-mabi=apcs-gnu" (non-EABI-compliant) or "-mabi=aapcs-linux" (EABI-compliant). To have an overview of all flags go here
$ sudo apt-get install libx11-6 libx11-dev texinfo libncurses5 libncursesw5 libncursesw5-dev zlibc


http://ecos.sourceware.org/docs-1.3.1/ref/gnupro-ref/arm/ARM_COMBO_ch01.html
== Paparazzi Main sourcecode ==


By changing -mapcs-32 with -Wa,-mapcs-32 compilation will work with more recent compilers and we have backward compatibility with the old flag for older compilers. The option -Wa,-mapcs-32 is doing the following: ''-Wa,option'' : Pass option as an option to the assembler. If option contains commas, it is split into multiple options at the commas.
See the main [[Installation#Getting_the_Source_Code]] page


The -mapcs-32 option generates code for a processor running with a 32-bit program counter and conforming to the function calling standards for the APCS 32-bit option. If interested in depth what APCS is read the following: http://www.openuas.org/site/APCS.txt
TIP:
If you get the File "pprz.mli", line 149, characters 78-89: Error: Unbound type constructor Ivy.binding
...this happens when IVY libraries are not yet installed. How to do this, read the part on installing IVY on this page


The gcc flag -mapcs-32 was deprecated since gcc-3.4.0 and finally removed in gcc-4.0.0 which unconditionally generates 32bit ARM code. You should not need to pass this flag to the assembler either but it might not hurt for backwards compatibility with older compilers, so it's best to leave it in with the -Wa, option metho


== Useful links ==
== Useful links ==


https://github.com/esden/summon-arm-toolchain
https://launchpad.net/gcc-arm-embedded/


https://github.com/paparazzi/paparazzi-portability-support
https://github.com/paparazzi/paparazzi-portability-support
http://svn.savannah.gnu.org/svn/paparazzi/paparazzi3/trunk/conf/Makefile.stm32


http://wiki.ubuntuusers.de/GNU_arm-toolchain
http://wiki.ubuntuusers.de/GNU_arm-toolchain
Line 548: Line 391:


http://mcuprogramming.com/forum/arm/gnu-arm-toolchain-installer/
http://mcuprogramming.com/forum/arm/gnu-arm-toolchain-installer/
http://code.google.com/p/hobbycode/source/browse/trunk/gnu-arm-installer


http://www.ethernut.de/en/documents/cross-toolchain-osx.html
http://www.ethernut.de/en/documents/cross-toolchain-osx.html
http://paparazzi.enac.fr/w/index.php?title=User:Roirodriguez


http://www.hermann-uwe.de/blog/building-an-arm-cross-toolchain-with-binutils-gcc-newlib-and-gdb-from-source
http://www.hermann-uwe.de/blog/building-an-arm-cross-toolchain-with-binutils-gcc-newlib-and-gdb-from-source


[[Category:Software]] [[Category:Developer_Documentation]] [[Category:Installation]]
[[Category:Software]] [[Category:Developer_Documentation]] [[Category:Installation]]

Latest revision as of 02:09, 24 August 2023

Users of recent Debian/Ubuntu distributions are advised to use the binary packages as described in Installation/Linux.

WARNING! Only use if you are proficient in working with Linux!

Intro

Users of other Linux flavors or anyone needing manual control of each individual package can install them independently.
The list of dependencies of the Debian package is located in the debian/control file and may help users of other distributions.

Some corresponding source tarballs can be downloaded from paparazzi-uav ppa on launchpad. (maybe building the packages from source is more reliable in view of dependencies)

For distributions using RPM packaging, the alien tool can be used to convert a .deb package into a .rpm package.

As with all Wiki pages, also this page is a work in progress. Try to be a big help to the Paparazzi project and improve this page whenever you can. If you have a distribution different from Ubuntu which doesn't satisfy any other dependency and have instructions about compiling it, packaging it, feel free to add any reference on how to do that on this wikipage.

Goal

The goal of this page is to clarify about which version of each piece of software has to be compiled, where to find that software, patches needed to make it compile on Linux, maybe even FreeBSD or OSX.

Fedora 19

To build paparazzi-uav on Fedora 19, you must install the next packages from the official repository:

  • ocaml
  • ocaml-findlib
  • ocaml-xml-light
  • ocaml-ocamlnet
  • ocaml-lablgtk-devel
  • libxml2-devel
  • SDL-devel
  • libusb-devel

Paparazzi-uav needs to include some ocaml headers when it compiles the simulator, then please be sure that they are included. If not, edit sw/simulator/Makefile and add:

 CAML_CFLAGS = -I/usr/lib64/ocaml

The following packages must be built from source code (they are not included in the official repository):

  • ivy-c
  • ivy-ocaml

Paparazzi-uav was successfully compiled using ivy-c 3.14 and ivy-ocaml 1.2. Please note that the ivy-c version is an unstable version!

Additionally, you need install the next RPMs to build ivy-c:

  • pcre-devel
  • libXt-devel
  • tcl-devel
  • glib2-devel

Don't forget to set the environment variable PKG_CONFIG before building ivy-ocaml, e.g:

 $ export PKG_CONFIG=/usr/local/lib/pkgconfig

Fedora 24

NOTE: Built upon Fedora 19 instruction, unnecessary instructions may occour.

1. Install dependencies:

 $ sudo dnf install ocaml ocaml-findlib ocaml-xml-light ocaml-ocamlnet ocaml-lablgtk-devel ocaml-camlp4-devel libxml2-devel SDL-devel libusb-devel pcre-devel libXt-devel tcl-devel tk-devel glib2-devel gsl-devel

2. Edit the PKG_CONFIG_PATH variable in your ~/.bashrc file to accomondate /usr/local/lib/pkgconfig/ (default for ivy libs)

3. Edit all the ivy specific .pc files in /usr/local/lib/pkgconfig, changing line 3 from "libdir=${exec_prefix}/lib" to "libdir=${exec_prefix}/lib64"

4. Install ivy-python via pip and compile and istall ivy-c and ivy-ocaml from source as shown Installation/FromScratch#IVY

Note: dependencies for compiling ivy-c and ivy-ocaml are already covered above (except toolchain!).

5. Compile and install JSBsim from source

Hacks: Link libivy and libJSBsim after compiling

 $ sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/lib
 $ sudo ln -s /opt/jsbsim/lib/libJSBSim.so.0 /usr/lib
 $ sudo ldconfig

Arch Linux

This is a dirty hacked together (not really according to "the Arch Way") install, but works on a fresh installed Archbang GNU/Linux.

NOTE: following issues

  1. Only written and tested for Archbang and Manjaro, not tested on vanilla Arch Linux yet.
  2. It seems that the error "unbound module GnoCanvas" can be resolved by installing lablgtk2 via yaourt first and then conf-gnomecanvas over opam.
  3. No symlink from liblglibivy.so.3 and liblglibivy.so.3 to libglibivy.so.3.15, so can't find these files.
  4. If pkg-config can't find some .pc files, a pkg-config path might not be set and exported properly. Use "pkg-config --variable pc_path pkg-config" to check if the path containing the ivy-c.pc, ivy-glib.pc and ivy-tcl.pc files is found.
  5. "ocamlfind: Package `netclient' not found" -> seems that the opam packages need to be installed in a specific order... (try ocamlnet first, then lablgtk.2.16)

Requirements:

  1. Up to date system
    • pacman -Syyu
  2. Install Yaourt

Install Paparazzi:

  1. Packages base-devel, yajl and general dependencies
    # pacman -S base-devel yajl subversion git libusb pcre ocaml camlp4 tcl tk python python-pip sdl glade
  2. Check if the PKG_CONFIG_PATH points to /usr/local/lib/pkgconfig, otherwise set and export it
    $ echo 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/' >> ~/.bashrc
  3. Build and install Ivy-C from Source
    $ git clone https://gitlab.com/ivybus/ivy-c.git /home/$USER/temp/ivy-c 
    $ cd /home/$USER/temp/ivy-c/src 
    $ make 
    $ sudo make install
  4. Dirty All the ivy libs are installed in /usr/local/lib64 and not /usr/local/lib as the .pc files point to currently.
    Change in the third line (libdir) in the ivy-c.pc, ivy-glib.pc and ivy-tcl.pc file from lib to lib64 and the fourth line (includedir) from include to include/Ivy
  5. DirtyFor libgivy, libivy and libtclivy (.so and .so.3 ending) is a link directing to the lib with .so.3.15 availaible, but not for libglibivy.
  6. Create these links for libglibivy
    $ sudo ln -s /usr/local/lib64/libglibivy.so.3.15 /usr/local/lib64/libglibivy.so 
    $ sudo ln -s /usr/local/lib64/libglibivy.so.3.15 /usr/local/lib64/libglibivy.so.3
  7. Install opam (OCaml packet manager) via yaourt
    $ yaourt -S opam
  8. Initialize opam
    $ opam init 
    $ f 
    $ ~/.bashrc 
    $ echo 'eval `opam config env`' >> ~/.bashrc
  9. Install and pin lablgtk.2.16.0 (2.18.0 will not work)
    $ opam install -v lablgtk.2.16.0 
    $ opam pin add lablgtk 2.16.0
  10. Install OCaml packets via opam
    $ opam install ocamlfind ocamlnet xml-light pcre ivy
    If this fails at Ivy related parts check the notes on top of this guide.
  11. Install ivy-python via pip
    $ sudo pip install ivy-python
  12. Install the Toolchain for Paparazzi (e.g. gcc-arm-none-eabi-bin from the AUR)
    $ sudo pacman -S gcc-arm-none-eabi-bin

Optional:

  1. Install flashing utilities if needed
$ yaourt stlink-git dfu-util
  1. Install JSBSim for NPS

Download and build Paparazzi

Installing the Cross compiler toolchain

There are currently two different toolchains available that can be used on Linux based systems with Paparazzi. For more information see Installation/Linux#ARM_embedded_toolchain

Installing OCaml packages using OPAM

One possibility to install and manage OCaml packages is OPAM (OCaml Package Manager):
Please first check the official OPAM install guide for the simplest method.
To install it from the latest git tree run:

git clone https://github.com/OCamlPro/opam.git
cd opam
./configure && make
sudo make install
opam init
eval `opam config env`

Update your shell environment as per opam init's instructions. E.g. add to your ~/.profile:

eval `opam config env`

Build and install OCaml libs:

opam install ocamlfind xml-light pcre ocamlnet
opam install -v lablgtk

IVY

IVY is a simple protocol and a set of open-source libraries and programs that allows applications to broadcast information through text messages, with a subscription mechanism based on regular expressions. The project can be found at: https://ivybus.gitlab.io/

In the paparazzi project, Ivy is used to send telemetry data to where ever you want.

NOTE: Do not confuse this IVY with the Apache Ivy project.

Ivy-python

The ivy-python package makes it possible to use the IVY libraries from within the Python programming language. The ivy-python package is architecture independent, so it can be downloaded from the Ubuntu or Debian paparazzi repository.

The easiest way to instally it on non Debian based systems is using pip to install the ivy-python package from PyPi - the Python Package Index.

pip install ivy-python

Or install from the source repository via

git clone https://gitlab.com/ivybus/ivy-python.git
cd ivy-python
./setup.py install

Ivy-c

To be able to use ivy-c, the libraries need to be installed.

Required packages (Debian based):

  • tk-dev
  • libpcre3-dev
  • libxt-dev
  • pkg-config
  • libglib2.0-dev

Download source, compile and install libraries:

# mkdir -p /opt/ivy-c 
# cd /opt/ivy-c
# git clone https://gitlab.com/ivybus/ivy-c.git
# cd /opt/ivy-c/trunk/src
# make
# make install

It is possible you get errors of the test module when compiling, just ignore the messages, it is not important for the Paparazzi project. Contact the IVY team to help them also to resolve also the testing makefile issue.

troubleshooting

Error message:

gcc -c -O2 -Wall -Wshadow -fPIC -I/usr/include/tcl8.4 -DTCL_CHANNEL_INTEGRATION  ivytcl.c
ivytcl.c:28:17: fatal error: tcl.h: No such file or directory

The Makefile cannot read the tcl-dev version you have installed and assumes that version 8.4 is installed, but can't find the appropriate folder.
Edit the line 57 of the Makefile from TCLVERS=8.4 according to your installed version, or just delete the 8.4, both work.


Can't find 64bit libs: Your ivy libs were probably installed to /usr/local/lib64 and you have to make symbolic links so that they will be found:

$ sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/lib

or

sudo ln -s /usr/local/lib64/libivy.so /usr/local/lib64/libivy.so.3 /usr/local/lib


Ivy-OCaml

ivy-ocaml provides OCaml bindings for ivy-c and is needed for most of the ground segment agents that are written in OCaml like Server and GCS.

Download source, compile and install libraries:

# mkdir -p /opt/ivy-ocaml
# cd /opt/ivy-ocaml
# git clone https://gitlab.com/ivybus/ivy-ocaml.git
# cd /opt/ivy-ocaml/trunk
# make
# make install

ivy-ocaml via OPAM

Or use OPAM: While the source repository and debian package is named ivy-ocaml, in OPAM it is only named ivy (since it is obviously for OCaml).

$ opam update
$ opam install ivy

LPC21ISP

lpc21isp is only needed to serially flash the LPC2148 based autopilots (e.g. Lpc21BootloaderUpload bootloader for tiny, twog, umarim). LPC21ISP is an in-circuit programming (ISP) tool for the microcontroller used on the Paparazzi autopilot boards. The lpc21isp project is hosted on sourceforge and one can find the source packages and information at http://sourceforge.net/projects/lpc21isp/

Get the SVN version via

$ mkdir -p /opt/lpc21isp
$ cd /opt/lpc21isp
$ svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp lpc21

To compile go into the source directory and then do

$ cd lpc21
$ make -f Makefile clean all

To install

$ exportline="PATH=$PATH:/opt/lpc21isp"
$ if grep -Fxq "$exportline" ~/.profile; then echo nothing to do ; else echo $exportline >> ~/.profile; fi
$ source ~/.profile

Paparazzi-dev Debian/Ubuntu packages

For Ubuntu users, you can install the following packages from standard repository. You can just copy the line(s) and paste into your terminal. But do not copy the $ sign, this symbol is just added on this page to show that it is to be pasted at a normal terminal prompt.

Whole lot in one

 sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
                      liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev libpcre-ocaml \
                      libpcre-ocaml-dev libgnomecanvas2-0 libgnomecanvas2-dev libglade2-0 libglade2-dev make build-essential \
                      git gnuplot m4 libtool libftdi-dev libmpfr-dev tcl8.5-dev xutils-dev

Ocaml and libraries

Ocaml, short for Objective Caml is the most popular variant of the Caml language. The Paparazzi Ground Control Station (GCS) and some of it's tools are crafted in this language.

  • ocaml, ocaml-camlimages-devel, ocaml-lablgtk2-devel, ocaml-xml-light-devel, ocamlnet-ocaml-devel
$ sudo apt-get install ocaml libcamlimages-ocaml liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-dev \
                       liblablgtk2-gnome-ocaml-dev libxml-light-ocaml-dev libocamlnet-ocaml-dev

Gnome canvas Library

The GnomeCanvas is an engine for structured graphics that offers a rich imaging model, high performance rendering, and a powerful, high level API. This widget can be used for flexible display of graphics and for creating interactive user interface elements.

$ sudo apt-get install libgnomecanvas2-0 libgnomecanvas2-dev

USB Library

The libusb project aims to create a library for use by user level applications to access USB devices regardless of OS. [1]

$ sudo apt-get install libusb-dev

Ocaml PCRE

This OCaml-library interfaces the PCRE (Perl-compatibility regular expressions) C library. it can be used for matching regular expressions which are written in Perl style.

$ sudo apt-get install libpcre-ocaml libpcre-ocaml-dev

Glade Library

Libglade is a library that performs a similar job to the C source output routines in the GLADE user interface builder. Whereas GLADE's output routines create C source code that must be compiled, libglade builds the interface from an XML file (GLADE's save format) at runtime. This can allow modifying the user interface without recompiling.

$ sudo apt-get install libglade2-0 libglade2-dev

Tcl/Tk

$ sudo apt-get install tcl-dev

Also the some utils are required to compile and install Ivy.

$ sudo apt-get install xutils-dev

Make

GNU Make is an utility which controls the generation of executables and other target files of a program from the program's source files.

$ sudo apt-get install make

Build essential

$ sudo apt-get install build-essential

Libtool

GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface. Creating the files for Paparazzi software building becomes less cumbersome by using this tool.

$ sudo apt-get install libtool

libpcre3-dev

Required for compiling Ivy-C.

$ apt-get install libpcre3-dev

Git Client

Git is a version control system. Version control systems allow many individuals to collaborate on the Paparazzi source code. This is needed to retrieve the latest sourcecode from various packages and Paparazzi sourcecode itself.

$ sudo apt-get install git

Subversion

Version control system, required for cloning the ivy packages.

$ apt-get install subversion

GNU Plot

A command-line driven interactive plotting program. Unknow if it is used

$ sudo apt-get install gnuplot

Meld

Meld is a graphical front end to the diff program. It provides a side-by-side view of the differences between two files. It is used by the Paparazzi Center when configuration changes are not yet saved and the option comes along where one either can keep or view changes made in aircraft- and other configuration files.

$ sudo apt-get install meld

FTDI library

libftdi is a library that talks to FTDI's 232 type chips, including the popular bitbang mode, using libusb. A library to be able to use with a debugging Autopilot hardware boards.

$ sudo apt-get install libftdi-dev 

MPFR library

The MPFR library is a C library for multiple-precision floating-point computations with correct rounding. MPFR is based on the GMP multiple-precision library. The main goal of MPFR is to provide a library for multiple-precision floating-point computation which is both efficient and has a well-defined semantics.

$ sudo apt-get install libmpfr-dev

ImageMagick

ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. Being able to modify image based map pictures is a feature that may come in handy one time.

$ sudo apt-get install imagemagick

Optional on an older OS

If you have an older OS distribution it never hurts to install the following...

$ sudo apt-get install libx11-6 libx11-dev texinfo libncurses5 libncursesw5 libncursesw5-dev zlibc

Paparazzi Main sourcecode

See the main Installation#Getting_the_Source_Code page

TIP: If you get the File "pprz.mli", line 149, characters 78-89: Error: Unbound type constructor Ivy.binding ...this happens when IVY libraries are not yet installed. How to do this, read the part on installing IVY on this page


Useful links

https://launchpad.net/gcc-arm-embedded/

https://github.com/paparazzi/paparazzi-portability-support

http://wiki.ubuntuusers.de/GNU_arm-toolchain

http://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/ARM-Options.html#ARM-Options

http://mcuprogramming.com/forum/arm/gnu-arm-toolchain-installer/

http://www.ethernut.de/en/documents/cross-toolchain-osx.html

http://www.hermann-uwe.de/blog/building-an-arm-cross-toolchain-with-binutils-gcc-newlib-and-gdb-from-source