Difference between revisions of "Installation/FromScratch"

From PaparazziUAV
Jump to navigation Jump to search
m
 
(129 intermediate revisions by 14 users not shown)
Line 1: Line 1:
IN PROGRESS, this page surely not finished, be good to the World and help improving this page if you can!
<categorytree style="float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;" mode=pages>Installation</categorytree>
__TOC__


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


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 64Bit. This includes compiling all paparazzi-dev, paparazzi-arm7 and paparazzi-bin software on a 64Bit machine, running an Ubuntu Lucid Lynx or later Linux distribution or maybe even OSX. The Text below has it's origins from http://paparazzi.enac.fr/w/index.php?title=User:Roirodriguez and the OpenUAS internal Wiki. Based on texts from Roi Rodriguez
<span style="color:#FF0000">'''WARNING! Only use if you are proficient in working with Linux!'''</span>


Sometimes you see 'QUESTION:' at the beginning of the lines that represent questions still open, patches unsure to be accurate, etc. This way everyone can improve the page a little easier.
== Intro ==


== Paparazzi-dev packages ==
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.


For Ubuntu users, you can install the following packages from standard repository:
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)


=== Ocaml and libraries ===
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.


Ocaml, short for Objective Caml is the most popular variant of the Caml language. The Paparazzi GCS and some of it's tools are crafted in this language.
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.


* ocaml, ocaml-camlimages-devel, ocaml-lablgtk2-devel, ocaml-xml-light-devel
== Goal ==


$ sudo aptitude install ocaml libcamlimages-ocaml lablgtk2-ocaml libxml-light-ocaml
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.


=== Boa ===
== Fedora 19  ==


Lightweight and high performance web server, a single-tasking HTTP server.
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


$ sudo aptitude install boa
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:


=== Gnome canvas Library ===
  CAML_CFLAGS = -I/usr/lib64/ocaml


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.
The following packages must be built from source code (they are not included in the official repository):
* ivy-c
* ivy-ocaml


$ sudo aptitude install libgnomecanvas2-0 libgnomecanvas2-dev
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!


=== USB Library ===
Additionally, you need install the next RPMs to build ivy-c:
* pcre-devel
* libXt-devel
* tcl-devel
* glib2-devel


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
Don't forget to set the environment variable PKG_CONFIG before building ivy-ocaml, e.g:


$ sudo aptitude install libusb-dev
  $ export PKG_CONFIG=/usr/local/lib/pkgconfig


=== Ocaml PCRE ===
== Fedora 24  ==
NOTE: Built upon Fedora 19 instruction, unnecessary instructions may occour.


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


$ sudo aptitude install libpcre-ocaml libpcre-ocaml-dev
2. Edit the PKG_CONFIG_PATH variable in your ~/.bashrc file to accomondate /usr/local/lib/pkgconfig/ (default for ivy libs)


=== Glade Library ===
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"


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.
4. Install ivy-python via pip and compile and istall ivy-c and ivy-ocaml from source as shown [[Installation/FromScratch#IVY]]


$ sudo aptitude install libglade2-0 libglade2-dev
Note: dependencies for compiling ivy-c and ivy-ocaml are already covered above (except toolchain!).


=== make ===
5. Compile and install [[JSBSim|JSBsim from source]]


GNU Make is an utility which controls the generation of executables and other target files of a program from the program's source files.  
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


$ sudo aptitude install make
== Arch Linux ==


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


$ sudo aptitude install build-essential
'''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)


=== subversion client ===
'''Requirements:'''
# Up to date system
#* pacman -Syyu
# Install Yaourt
#*https://astrofloyd.wordpress.com/2015/01/17/installing-yaourt-on-arch-linux/


Subversion, also known as svn, is a version control system. Version control systems allow many individuals to collaborate on the paparazzi source code. This is needed to retreive the latest sourcede from various packages and Paparazzi itself
'''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 aptitude install subversion
Optional:


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


A command-line driven interactive plotting program. Unknow if it is used
[[Installation#Getting_the_Source_Code|Download]] and [[Installation#Launching_the_Software|build Paparazzi]]
$ sudo aptitude install gnuplot


=== Imagemagick ===
== Installing the Cross compiler toolchain ==


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. This pacage is needed for ?
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]]


$ sudo aptitude install imagemagick
== Installing OCaml packages using OPAM ==


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


If you have an older OS distribution it never hurts to install the following...
opam init
eval `opam config env`


  $ sudo aptitude install libx11-6 libx11-dev texinfo flex bison libncurses5 libncurses5-dbg libncurses5-dev libncursesw5 libncursesw5-dbg libncursesw5-dev zlibc
Update your shell environment as per opam init's instructions. E.g. add to your ''~/.profile'':
  eval `opam config env`


=== Building the ARM cross-toolchain ===
Build and install OCaml libs:
opam install ocamlfind xml-light pcre ocamlnet
opam install -v lablgtk


Building an ARM cross-toolchain with binutils gcc newlib and gdb from source, see also http://code.google.com/p/hobbycode/source/browse/trunk/gnu-arm-installer
==  IVY ==
(REMOVE: where and how to get the latest working versions.... * arm-gp2x-linux-gcc.x * arm-gp2x-linux-binutils.x )


#!/bin/sh
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/


TARGET=arm-none-eabi   # Or: TARGET=arm-elf
In the paparazzi project, Ivy is used to send telemetry data to where ever you want.
PREFIX=/tmp/your-arm-toolchain    # Install location of the final toolchain
SPEEDUPCOMPILATION="-j 4"   # Or: SPEEDUPCOMPILATION=""


BINUTILS=binutils-2.20.1
NOTE: Do not confuse this IVY with the Apache Ivy project.  
GCC=gcc-4.4.4
NEWLIB=newlib-1.18.0
GDB=gdb-7.1


export PATH="$PATH:$PREFIX/bin"
=== Ivy-python ===
 
mkdir build
 
wget -c http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
tar xfvj $BINUTILS.tar.bz2
cd build
../$BINUTILS/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls
make $COMPILEFASTER
make install
cd ..
rm -rf build/* $BINUTILS $BINUTILS.tar.bz2
 
wget -c ftp://ftp.gnu.org/gnu/gcc/$GCC/$GCC.tar.bz2
tar xfvj $GCC.tar.bz2
cd build
../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --enable-languages="c" --with-newlib --without-headers --disable-shared --with-gnu-as --with-gnu-ld
make $SPEEDUPCOMPILATION all-gcc
make install-gcc
cd ..
rm -rf build/* $GCC.tar.bz2
 
wget -c ftp://sources.redhat.com/pub/newlib/$NEWLIB.tar.gz
tar xfvz $NEWLIB.tar.gz
cd build
../$NEWLIB/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls
make $SPEEDUPCOMPILATION
make install
cd ..
rm -rf build/* $NEWLIB $NEWLIB.tar.gz
 
# GCC needes to be build again including the real newlib now
cd build
../$GCC/configure --target=$TARGET --prefix=$PREFIX --enable-interwork --enable-multilib --enable-languages="c,c++" --with-newlib --disable-shared --with-gnu-as --with-gnu-ld
make $SPEEDUPCOMPILATION
make install
cd ..
rm -rf build/* $GCC


wget -c ftp://ftp.gnu.org/gnu/gdb/$GDB.tar.bz2
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.
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 $GDB.tar.bz2


==== Newlib ====
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
Newlib library built for ARM targets.
 
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.
 
==  IVY ==
 
About ivy-c, ivy-c-dev, ivy-ocaml and ivy-python packages.  
 
The rest of the software on which paparazzi-dev depends can be found in the ubuntu repositories for Lucid. 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.
 
=== Ivy-python ===


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 to download it from the official source repository via  
Or install from the source repository via  
   
   
  $ mkdir ~/develop
  git clone https://gitlab.com/ivybus/ivy-python.git
$ mkdir ~/develop/ivy/
  cd ivy-python
$ cd ~/develop/ivy/
  ./setup.py install
$ svn co http://svn.tls.cena.fr/svn/ivy/ivy-python/trunk
 
=== About Ivy versions ===
 
You can find the Ivy software bus homepage at http://www2.tls.cena.fr/products/ivy/. There you can find documentation, svn repository location, etc.
 
If you take a look to the files at http://paparazzi.enac.fr/ubuntu/dists/lucid/main/binary-i386/ you'll see
 
* ivy-c 3.11.4-1, source files provided.
* ivy-ocaml 1.1, with 3 package revisions (7, 8 and 9). Source files are provided for 1.1-7 at http://paparazzi.enac.fr/debian/dists/lenny/main/binary-i386/ivy-ocaml_1.1-7.tar.gz.
 
If you take a look to the control files of each of those ivy-ocaml packages (you can do it downloading the package and then ''dpkg --info PACKAGE_DOWNLOADED'' from the command line. See the line starting with 'Depends:') you'll see all of them tell to be compatible with ivy-c versions >= 3.8.
 
However my experience with ivy-ocaml_1.1-7 (the only one for which source code is provided) is that it is not compatible with ivy-c 3.11.4. The ''civyloop.c'' source file in the ivy-ocaml_1.1-7 package makes use of the IvyMainLoop function (defined in the ivy-c package) in the following way:
 
  value ivy_mainLoop(value unit)
{
  IvyMainLoop (NULL, NULL);
  return Val_unit;
}
 
Definitions for the IvyMainLoop function in the ivy-c package are as follows. For 3.8:
 
  extern void IvyMainLoop(void(*BeforeSelect)(void),void(*AfterSelect)(void) );
 
And for 3.11:
 
extern void IvyMainLoop(void);
 
So 3.8 version of that function has 2 arguments and 3.11 has no arguments at all. So we've to use 3.8 version. We'll get an error about 'too much arguments for IvyMainLoop' if we try to compile ivy-ocaml_1.1-7 with ivy-c_3.11.4-1.
 
But there's no source for ivy-c_3.8.1-1 in the paparazzi repository, where did i get it from? From the ivy-c svn repository, the svn command is the following:
 
svn co http://svn.tls.cena.fr/svn/ivy/ivy-c/tags/debian_version_3_8_1-1 ivy-c_3.8.1
 
NOTE: Don't try to get ivy-ocaml too from the main ivy svn repository at http://svn.tls.cena.fr/svn/ivy/ivy-ocaml. Rumour has it  that main developer Pascal Brisset told to use http://paparazzi.enac.fr/ubuntu/dists/lucid/main/binary-i386/ivy-ocaml_1.1-10.tar.gz file in the paparazzi repository instead. SVN repository for ivy-ocaml seems unused, which seem strange since Pascal Brisset is also the maintaner of the SVN version.
 
So we'll compile ivy-c_3.8.1 coming from the main ivy-c svn repository,
 
and ivy-ocaml_1.1-7.tar.gz in the paparazzi repository (link above).
 
QUESTION: Where do i find sources (tar.gz) for ivy-ocaml_1.1 revisions 8 and 9??
QUESTION: Wouldn't it be better to change ivy-ocaml_1.1-7 control file to depend strictly on ivy-c 3.8 version?


=== Ivy-c ===
=== Ivy-c ===


As told above, source packages for this version of ivy-c can be downloaded with the following command (command line):
To be able to use ivy-c, the libraries need to be installed.  
 
svn co http://svn.tls.cena.fr/svn/ivy/ivy-c/tags/debian_version_3_8_1-1 ivy-c_3.8.1
 
Compilation
 
To compile it you've just enter the src directory and type make, then make install as usual:
 
cd ivy-c_3.8.1/src
make
sudo make install
 
This will compile the sources and install header files, libraries and the ivyprobe program under /usr/local on your system.


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


Compilation That doesn't work on 64bit systems, if you just run 'make':
Download source, compile and install libraries:


  /usr/bin/ld: civyloop.o: relocation R_X86_64_32 against `timer_cb' can not be used when making a shared object; recompile with -fPIC
  # 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


That's solved by just editing the Makefile. Change the line:
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.


.c.o�:
==== troubleshooting ====
        $(CC) -Wall -c $(OCAMLINC) $(GLIBINC) $<


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


.c.o�:
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/>
        $(CC) -Wall -c -fPIC $(OCAMLINC) $(GLIBINC) $<
Edit the line 57 of the Makefile from TCLVERS=8.4 according to your installed version, or just delete the 8.4, both work.


And done.


The following section (debian packaging) does the same but distributing the change as a dpatch to the sources instead editing the Makefile. This way we don't modify the sources, but just distribute a patch which can be integrated in debian/rules or used by its own (read dpatch manual page, ''man dpatch'').
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


NOTE: This solution is to avoid modifying the original sources. A proper patch for the original sources would be one that checks if the system is a 64bit system, and if so set FPIC env variable, the following code at the begining of the Makefile would be ok (taken from ivy-c Makefile):


PERHAPS64�:= $(shell uname -m | perl -ne "print /64/�? '64'�: '';")''
=== Ivy-OCaml ===
ifeq ($(PERHAPS64), "64")
        FPIC=
else
        FPIC=-fPIC
endif


And then let the rule to compile all .c and .o files be like the following:
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]].


.c.o�:
Download source, compile and install libraries:
        $(CC) -Wall -c $(FPIC) $(OCAMLINC) $(GLIBINC) $<


# 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


Paparazzi-arm7 packages
==== 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).


IMPORTANT The configure script for gcc must be run with sudo (or as root), because it copies some of the newlib headers to /usr/local!!!!
$ opam update
$ opam install ivy


== LPC21ISP ==


=== LPC 2 LISP ===
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/  
 
The lpc21isp project is hosted on sourceforge. You can find the source packages at http://sourceforge.net/projects/lpc21isp/  


Get the SVN version via
Get the SVN version via
 
$ mkdir -p /opt/lpc21isp
$ cd /opt/lpc21isp
  $ svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp lpc21
  $ svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp lpc21


To compile and install
To compile go into the source directory and then do


  $ make clean
  $ cd lpc21
  $ make  
  $ make -f Makefile clean all
$ sudo make install


==== Compilation ====
To install


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


Just:
== Paparazzi-dev Debian/Ubuntu packages ==


make
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.
sudo make install


Would work.
=== Whole lot in one ===


[[#Debian_packages_4]]
  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


!!!!! Debian packages
=== Ocaml and libraries ===


I've debianized the sources running dh_make (single binary package, after dh_make i removed unecessary files from the debian directory). Then i simply ran:
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.


dpkg-buildpackage -r fakeroot -uc -us
* ocaml, ocaml-camlimages-devel, ocaml-lablgtk2-devel, ocaml-xml-light-devel, ocamlnet-ocaml-devel


You can get the debianized source package, as well as the deb packages from http://imasdtrade.x10hosting.com/paparazzi.
$ 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


[[#Paparazzi-bin_package]]
=== Gnome canvas Library ===


!!! Paparazzi-bin package
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.


The source code compiled below was obtained from the svn trunk:
$ sudo apt-get install libgnomecanvas2-0 libgnomecanvas2-dev


svn co svn://svn.savannah.nongnu.org/paparazzi/paparazzi3/trunk paparazzi3
=== USB Library ===


The revision obtained was r4909.
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]


NOTE: The deb package generated has some problems (see below). The compilated non-packaged version works well. You must note too that some software in the deb package were compiled with the untested arm7 toolchain in the previous section, so it must not be used until that is properly tested.
$ sudo apt-get install libusb-dev


=== Ocaml PCRE ===


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


If you enter the sources directory and simply run ''make'' you will get the following error in an amd64 system:
$ sudo apt-get install libpcre-ocaml libpcre-ocaml-dev


cd sw/ground_segment/multimon; make PAPARAZZI_SRC=/home/roi/Codigo/paparazzi-dev/lenny_versions/paparazzi/temp PAPARAZZI_HOME=/home/roi/Codigo/paparazzi-dev/lenny_versions/paparazzi/temp
=== Glade Library ===
CC hdlc.c
hdlc.c:1: error: CPU you selected does not support x86-64 instruction set


This is because the code in sw/ground_segment/multimon/filter-i386.h which contains optimizations for some functions gets included and it doesn't work on amd64. filter.h says that filter-i386.h gets included if:
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.


  #ifdef ARCH_I386
  $ sudo apt-get install libglade2-0 libglade2-dev
#include "filter-i386.h"
#endif /* ARCH_I386 */


If we take a look to the Makefile (sw/ground_segment/multimon/Makefile):
=== Tcl/Tk ===


  CFLAGS          =-Wall -Wstrict-prototypes -I/usr/X11R6/include -I `ocamlc -where`
  $ sudo apt-get install tcl-dev
ifeq ($(DEBUG),y)
CFLAGS          +=-g -O -march=i486 -falign-loops=2 -falign-jumps=2 \
                  -falign-functions=2 -DARCH_I386
else
CFLAGS          +=-O3 -march=i486 -falign-loops=2 -falign-jumps=2 \
                  -falign-functions=2 -DARCH_I386
endif


We'll have to change it to not define ARCH_I386, not optimize for i486 and add -fPIC. So we need to leave the above lines like:
Also the some utils are required to compile and install Ivy.


  CFLAGS          =-Wall -fPIC -Wstrict-prototypes -I/usr/X11R6/include -I `ocamlc -where`
  $ sudo apt-get install xutils-dev
ifeq ($(DEBUG),y)
CFLAGS          +=-g -O -falign-loops=2 -falign-jumps=2 \
                  -falign-functions=2
else
CFLAGS          +=-O3 -falign-loops=2 -falign-jumps=2 \
                  -falign-functions=2
endif


Note that leaving the sources like this won't apply the optimizations if now you take the modified source and compile it in a 32bit system... Once my paparazzi-bin deb package (see below) works well i'll provide better patches for all the modifications explained here.
=== Make ===


Now it compiles ok. I run ./paparazzi and test it with a simulation and everything seems fine.
GNU Make is an utility which controls the generation of executables and other target files of a program from the program's source files.  


[[#Debian_packages_5]]
$ sudo apt-get install make


!!!! Debian packages
=== Build essential ===


The package generated here don't fully work (read at the end to see what fails), so don't use it but for testing purposes. The compiled sources compiled like above works well.
$ sudo apt-get install build-essential


First of all, don't simply run dpkg-buildpackage, there's a Makefile rule instead! Just run:
=== Libtool ===


make deb
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.


With the revision i downloaded i get the following error:
$ sudo apt-get install libtool


install -o root -m 644 var/maps/trtqtttqtsrrtstq*.jpg var/maps/trtqtttqtsrrttsr*.jpg /home/roi/Codigo/paparazzi-dev/lenny_versions/paparazzi/temp/debian/paparazzi-bin/usr/share/paparazzi/data/maps
=== libpcre3-dev ===
install: no se puede efectuar `stat' sobre �var/maps/trtqtttqtsrrtstq*.jpg�: No existe el fichero � directorio
install: no se puede efectuar `stat' sobre �var/maps/trtqtttqtsrrttsr*.jpg�: No existe el fichero � directorio
make[3]: *** [install_data] Error 1


It seems that there's a map trying to be installed that cannot be found in the sources. Just remove that jpg from the Makefile.install file, that's remove line 22 of Makefile.install:
Required for compiling Ivy-C.


  $(INSTALLDATA) var/maps/trtqtttqtsrrtstq*.jpg var/maps/trtqtttqtsrrttsr*.jpg $(DESTDIR)/data/maps
  $ apt-get install libpcre3-dev


QUESTION: Where am i supposed to get that map file from? Or does that line from Makefile.install need to be removed from the repository?
=== Git Client ===


If now we run ''make deb'' again, the error is now:
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.


  dpkg-gencontrol: error: current host architecture 'amd64' does not appear in package's architecture list (i386)
  $ sudo apt-get install git


That's because debian/control says it's a i386 only package. We've got to edit the control file, in my case i did:
=== Subversion ===


cd debian
Version control system, required for cloning the ivy packages.
cp control.lenny control.karmic
cp changelog.lenny changelog.karmic


Then i edited debian/control.karmic and changed the line saying ''Architecture: i386'' by ''Architecture: any''. Now i run:
$ apt-get install subversion


make DISTRO="karmic" deb
=== GNU Plot ===


(See deb rule in the makefile to see how the DISTRO env variable is used).
A command-line driven interactive plotting program. Unknow if it is used
$ sudo apt-get install gnuplot


Now it compiles properly. I'm going up one level and install that paparazzi-bin deb package but it fails:
=== Meld ===


cd ..
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 dpkg --install paparazzi-bin_3.10-2_amd64.deb


  Configurando paparazzi-bin (3.2-10) ...
  $ sudo apt-get install meld
File "_none_", line 1, characters 0-1:
Error: Error while linking kml.cmo:
Reference to undefined global `Server_globals'


So the postinst script is failing. It's located in debian/paparazzi-bin.postinst. Taking a look at that file one can see that all it does is to enter some directories and compile ocaml binaries. Even more, if one takes a look at those directories one can see that that binaries were compiled in the build process so:
=== FTDI library ===


QUESTION: Why aren't those binaries just being installed as usual? Is there any reason or simply there were problems trying to make them installed in the deb package?
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.


I fixed it comparing the source dirs Makefiles with the compilation commands in the postinst file. I one compares between them for each directory in the postinst, it can be seen that there are some missing cma and/or cmo files in some ''ocamlc'' commands. Putting down here every modification i made to the debian/paparazzi-bin.postinst file would become very large, so you can simply download my modified sources [[http://imasdtrade.x10hosting.com/paparazzi/paparazzi-bin_3.2-10.tar.gz | here]] and diff it against the original sources.
$ sudo apt-get install libftdi-dev


Now it compiles, so i go up one directory, install it again and test:
=== MPFR library ===


cd ..
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 dpkg --purge paparazzi-bin
sudo dpkg --install paparazzi-bin_3.10-2_amd64.deb


And everything goes ok. If i now run paparazzi from the command line it starts properly but says:
$ sudo apt-get install libmpfr-dev


mv: cannot stat `/home/roi/paparazzi/data/maps/trtqtttqtsrrt*.jpg': No such file or directory
=== ImageMagick ===


You can edit the Makefile.ac in the sources, eliminate the reference to that map file and reinstall and that disappears. Same QUESTION as above regarding to that map file: Where can i find that?
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.


There's a problem that still persists. If i now run paparazzi (with my $HOME/paparazzi dir empty!) it fails to run a simulation, the error is the following:
$ sudo apt-get install imagemagick


BUILD /home/roi/paparazzi/var/MJ5/airframe.h
=== Optional on an older OS ===
##################################################


  AIRFRAME MODEL: MJ5
If you have an older OS distribution it never hurts to install the following...
 
##################################################
make[1]: *** No rule to make target `/home/roi/paparazzi/conf/modules/*.xml', needed by `/home/roi/paparazzi/var/MJ5/modules.h'.  Stop.
make[1]: Leaving directory `/usr/share/paparazzi'
make: *** [ac_h] Error 2
make: Leaving directory `/usr/share/paparazzi'
 
Inspecting my /home/roi/paparazzi directory and comparing to /usr/share/paparazzi i can see that not all files where copied when paparazzi was first run. The curious thing is that if i run ./paparazzi from the sources dir instead executing the installed one (/usr/bin) everything works ok (PAPARAZZI_SRC is taken as PAPARAZZI_HOME this way)...
 
QUESTION: Any ideas on why? I'm sure i can solve it by myself, but if anybody knows...
 
OK Set the UDev rules.d
 
=== Get the Paparazzi source ===


To get the Paparazzi source via svn
$ sudo apt-get install libx11-6 libx11-dev texinfo libncurses5 libncursesw5 libncursesw5-dev zlibc


== Paparazzi Main sourcecode ==


If you get the  
See the main [[Installation#Getting_the_Source_Code]] page
    File "pprz.mli", line 149, characters 78-89:
    Error: Unbound type constructor Ivy.binding


  is since course, since IVY is not yet installed...
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/


* Get ivy-c  and ivy-c-dev on your system
https://github.com/paparazzi/paparazzi-portability-support
 
  Via svn co http://svn.tls.cena.fr/svn/ivy/ivy-c/trunk  (At the moment, still could not compile, under investigation...)
 
=== Get ivy-ocam on your system ===
 
Get ivy-ocam on your system via:
 
$ svn co http://svn.tls.cena.fr/svn/ivy/ivy-ocaml/trunk
 
I've read somwhere, but to not agree with the comment, since it just means the makefile must be improved, anyhow just as a reminder "Is this so:ivy-ocaml (WARNING: debian and fedora have different path for ocaml (/usr/lib/ocaml/<version> vs.
/usr/lib/ocaml), so you need to move by hand the files in /usr/lib/ocaml/<version> to /usr/lib/ocaml)"
 
=== The depriciated -mapcs-32 Option ===
 
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
 
http://ecos.sourceware.org/docs-1.3.1/ref/gnupro-ref/arm/ARM_COMBO_ch01.html
 
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.
 
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
 
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 ===


http://wiki.ubuntuusers.de/GNU_arm-toolchain
http://wiki.ubuntuusers.de/GNU_arm-toolchain
Line 486: 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]]
----
TEMP TEXT BELOW THIS LINE
 
Debian packages
 
The source we downloaded above is debianized. For 32bit systems you just need to:
 
cd ivy-c_3.8.1
dpkg-buildpackage -rfakeroot -uc -us
 
And done. You'll get your .deb packages in the directory containing ivy-c_3.8.1 (up one level).
 
For 64bit systems there's a problem: The Makefile at src/Makefile sets the relative path for the target libraries in the variable LIB. This is set to 'lib' or 'lib64', this last for 64bit systems. However, if you take a look at those debian/ivy-c.dirs and debian/ivy-c.install files there's no files being installed for usr/lib64 or usr/X11R6/lib64 (just usr/lib and usr/X11R6/lib libraries are installed in the debian package).
 
We'll modify debian/rules to override the LIB environment variable when calling make to equal 'lib' always (even if your system is a 64bit one, /usr/lib64 will be just a symbolic link to /usr/lib). Just change the line (debian/rules, remember):
 
cd src && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr
 
By:
 
cd src && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr LIB=/lib
 
And done, now you can run dpkg-buildpackage as usual.
 
You can find the sources for 3.8 already properly debianized for 64bit systems by me at http://imasdtrade.x10hosting.com/paparazzi/ivy-c_3.8.1-2.tar.gz. There you can find the .deb packages for ivy-c and ivy-dev (amd64) too. I've changed the debian/changelog file too...
 
== Debian packages ==
 
As told above, all we are going to do here is to distribute that change in the Makefile as a dpatch, and integrate the dpatch system into debian/rules. I'll not explain in depth how dpatch works, you can read http://www.debian.org/doc/maint-guide/ch-build.en.html for an introduction and then read the dpatch manual page (''man dpatch'').
 
Open debian/rules for editing and add, at the first line of the file (after the comments at the beginning), the following:
 
# Include dpatch stuff.
include /usr/share/dpatch/dpatch.make
 
That will include default dpatch rules for Makefiles, like 'patch', 'unpatch' and so.
 
Then edit the 'build' and 'clean' rules in debian/rules to depend on 'patch' and 'unpatch'. That means, replace the line:
 
build: build-stamp
 
By:
 
build: patch build-stamp
 
And the line:
 
clean:
 
By:
 
clean: unpatch
 
And done. This will make dpkg-buildpackage to apply the patches listed in debian/patches/00list before building, and deapply it on cleaning.
 
Now we've got to add our patch to debian/patches and list it in debian/patches/00list.amd64 (which lists patches being applied only for amd64 targets). For this run from the command line (you must be in the ivy-ocaml sources root dir!):
 
dpatch-edit-patch 01_ccfpic.dpatch
 
That will put you on a shell where you can edit all files you need. Just edit the Makefile as told above in ''Compiling'' and then type exit in that shell. After exiting a dpatch file will appear under debian/patches directory, named 01_ccfpic.dpatch.
 
Finally we've got to list that patch in a file called debian/patches/00list.amd64. Open that file for editing and add one single line saying:
 
01_ccfpic.dpatch
 
And now you can run dpkg-buildpackage to generate your deb packages.

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