wiki:toolchain/install

Version 21 (modified by Sanahuja Guillaume, 5 years ago) ( diff )

--

Toolchains installation

A cross toolchain is needed to compile on your computer a program for a target (different achitecture). A toolchain is needed to compile on your computer programs for your computer.

All toolchains/cross toolchains only supports x86_64 hosts (32 bits hosts are not supported).

Toolchains have been built with robomap3 project, based on poky. They package everything you need for flair.

NOTE: for sake of simplicity, the word compilation can be used in this documentation for both cross compilation and compilation

Toolchain for x86_64 (mandatory)

You need at least this one, as it used for compiling FlairGCS and other tools.

$ cd ~
$ wget https://uav.hds.utc.fr/src/toolchain/x86_64-meta-toolchain-flair-x86_64.sh
$ chmod +x x86_64-meta-toolchain-flair-x86_64.sh
$ sudo ./x86_64-meta-toolchain-flair-x86_64.sh
$ rm x86_64-meta-toolchain-flair-x86_64.sh

Cross toolchain for armv7a-neon (ardrone2, bebop, hds x8)

$ cd ~
$ wget https://uav.hds.utc.fr/src/toolchain/x86_64-meta-toolchain-flair-armv7a-neon.sh
$ chmod +x x86_64-meta-toolchain-flair-armv7a-neon.sh
$ sudo ./x86_64-meta-toolchain-flair-armv7a-neon.sh
$ rm x86_64-meta-toolchain-flair-armv7a-neon.sh

Cross toolchain for armv5e (mambo)

$ cd ~
$ wget https://uav.hds.utc.fr/src/toolchain/x86_64-meta-toolchain-flair-armv5e.sh
$ chmod +x x86_64-meta-toolchain-flair-armv5e.sh
$ sudo ./x86_64-meta-toolchain-flair-armv5e.sh
$ rm x86_64-meta-toolchain-flair-armv5e.sh

Setup files

Each toolchain install 2 important files needed for compilation:

  • environment-setup-arch-poky-linux-gnueabi: a script to source if you need to compile something manually, without CMake. For example /opt/robomap3/2.1.3/armv5te/environment-setup-armv5e-poky-linux-gnueabi
  • toolchain.cmake: a file used by CMake to get all information needed to compile with this toolchain. For example /opt/robomap3/2.1.3/armv5te/toolchain.cmake

The first one can be used to compile a kernel for example. The second one is needed for each CMake project, but is automatically used by the helper scripts, so you should not have to bother with it, unless you want to build a CMake project not in the flair build system.

Environment variable

Toolchain installation scripts add variables in .bashrc. If you need to use it directly in the same terminal or an already opened one, reload your .bashrc

$ source ~/.bashrc

These variables are:

  • OECORE_CMAKE_TOOLCHAINS: a list of installed toolchains (for example core2_64 armv7a_neon armv5te)
  • OECORE_CMAKE_arch_TOOLCHAIN: where arch is from the previous list (for example OECORE_CMAKE_CORE2_64_TOOLCHAIN). Location of the toolchain.cmake file for a specific architecture
  • OECORE_HOST_SYSROOT: used by ground control station to retrieve maps provider plugins (for gps)
  • OECORE_HOST_NATIVE_SYSROOT: used to retrieve host's cmake and doxygen tools.

Installation des drivers graphiques (maybe deprecated)

  • Si vous possédez une carte vidéo type nvidia, il faut copier les librairies dans la toolchain:
    $ sudo cp -r /usr/lib/nvidia-340/* /opt/robomap3/1.7.3/core2-64/sysroots/core2-64-poky-linux/usr/lib 
    
  • Pour une carte vidéo de type ATI:
    $ sudo cp -r /usr/lib/fglrx/* /opt/robomap3/1.7.3/core2-64/sysroots/core2-64-poky-linux/usr/lib 
    
  • For an Intel graphic card, it's a little bit more complicated, due to several versions and path for the libraries.

The idea is that we're using the system video card driver since it's not included in robomap3.

The driver itself (eg: i965_dri.so) should be loaded automatically (from /usr/lib/x86_64-linux-gnu/dri/). But this driver may not succesfully load since it requires some specific library versions that may not match robomap3's.

To debug this you should launch your 3D graphic program (eg: simulator) with the LIBGL_DEBUG environment variable set to verbose. For example

$ LIBGL_DEBUG=verbose ./LineFollower_simulator_nrt -n x4_0 -t x4 -a 127.0.0.1 -p 9000 -x setup_x4.xml (...)

Notice the line that look like libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/lib/x86_64-linux-gnu/dri/i965_dri.so) . This means that the local system driver needs a version of libstdc++.so.6 that defines the symbol CXXABI_1.3.9 (meaning application binary interface version 1.3.9). The version of libstdc++ included in robomap3 probably doesn't define this symbol. You can make sure with

strings /.../robomap3/1.7.3/core2-64/sysroots/core2-64-poky-linux/usr/lib/libstdc++.so.6 | grep CXXABI_ 

So we need to preload the libstdc++ library of the system to avoid robomap3 one to be loaded. To achieve this we need to set the LD_PRELOAD environment variable like this

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./LineFollower_simulator_nrt ...

Stopping here may be enough, but you then can see errors like i965_dri.so: undefined symbol: nouveau_drm_new .

Same problem: the driver needs a version of a library (here libdrm_nouveau.so.2) which defines a specific symbol that doesn't exist in robomap3 version (yet).

Same solution: preload the local system library. Repeat this until all unresolved symbols are gone.

On ubuntu 16.10 with robomap3 1.7.3, I ended up with the following

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libdrm_intel.so.1:/usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2:/usr/lib/x86_64-linux-gnu/libdrm_radeon.so.1  ./LineFollower_simulator_nrt -n x4_0 -t x4 ...

To avoid setting this variable every time, you can modify the script used to launch the program (usually in build/bin, eg: simulator_xx.sh) and add this line after the first one

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libdrm_intel.so.1:/usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2:/usr/lib/x86_64-linux-gnu/libdrm_radeon.so.1
Note: See TracWiki for help on using the wiki.