|Version 7 (modified by 4 years ago) ( diff ),|
NOTE: For Flair version <= 0.2.1, see this page.
Only Flair sources are provided. You need to compile everything by yourself to get development files, demos and tools.
Some scripts are provided to help configuration and compilation of projects. Using it you can compile everything easily. They are included in flair-dev repository.
- cmake_codelite_outofsource.sh: configure a project for CodeLite for all available toolchains
- flair_compile_all.sh: compile libs, tools and demos with all available toolchains. It calls cmake_codelite_outofsource.sh to configure projects.
CMake & CodeLite
Flair uses CMake as project descriptor. One recommended IDE is CodeLite. The helper scripts will produce projects for CodeLite from CMakeLists.txt but you can adapt it to your favourite IDE.
All CMakeLists in flair use custom modules located in flair-dev. The 2 principal ones are:
- FlairUseFile.cmake: used by demos/tools, it helps adding include dirs and libraries for programs using flair
A better explanation on how to use these modules can be found here.
Each installed toolchain have a toolchain.cmake file (for example /opt/robomap3/2.1.3/armv5te/toolchain.cmake) which defines everything needed by CMake to compile for a specific architecture.
Out of source build
The recommended usage is to build everything out of source, in order to keep your svn repositories clean. Helper script (flair_compile_all.sh) will build everything in $FLAIR_ROOT/flair-build directory.
One directory by architecture
cmake_codelite_outofsource.sh creates a folder by supported architecture (ie by installed toolchain). For exemple:
- build_armv7a_neon for armv7a-neon architecture (ardrone2, bebop, hds x8)
- build_armv5e for armv5e architecture (mambo)
- build_cortexa7thf_neon_vfpv4 for cortexa7thf-neon-vfpv4 architecture (raspberry pi)
- build_core2_64 for core2_64 architecture (PC)
Note that there is also a symlink from build to build_core2_64.
Compile Flair libraries, tools and demos all together
To compile all Fl-AIR stuffs, you can execute the dedicated script:
If it is the first time you execute this script, you must answer yes to the question Compile all from scratch. This will create every projects using cmake.
The script detects installed toolchains and compile everything for each supported architecture.
Results are the following:
- flair libs headers installed in $FLAIR_ROOT/flair-dev/include
- flair libs binaries installed in $FLAIR_ROOT/flair-bin/lib
- flair tools binaries installed in $FLAIR_ROOT/flair-bin/tools/core2-64 (but launching scripts are in $FLAIR_ROOT/flair-bin/tools/scripts)
- flair demos binaries installed in $FLAIR_ROOT/flair-bin/demos
For Heudiasyc users, additional stuffs are also installed:
- flair hds libs headers installed in $FLAIR_ROOT/flair-hds/dev/include
- flair hds libs binaries installed in $FLAIR_ROOT/flair-hds/bin/lib
- flair hds demos binaries installed in $FLAIR_ROOT/flair-bin/demos
Compile only a project
Compilation with debug (optional)
If you have to debug surprising segfaults (you know what I mean, do you? :D ) you will need to compile your code in debug mode (see below). Then you'll have to activate the core dump generation (in each terminal) with
$ ulimit -c unlimited
To be sure that the kernel will generate those migthy core file you should issue this command
echo core > /proc/sys/kernel/core_pattern (en sudo)
Then when your program crashes, it will generate a "core" file. Use gdb with your binary as the first parameter (again, compiled in debug mode) and the core file as the second parameter (use your cross compiled gdb in case of cross development, arm-poky...-gdb for instance to debug an arm code from your PC). It should load your program symbols. Then the "bt" command will show the backtrace, which is the sequence of function calls that resulted in the crash, allowing you to know exactly where is the problem.
If you want to debug the framework itself, you may find beneficial to compile the full framework in debug mode you need to edit the file
and add "-g -O0" to the CMAKE_CXX_FLAGS variable. As of this writing, and for an x86 architecture, the file to edit is "/opt/robomap3/2.1.3/core2-64/toolchain.cmake". Then you shall rebuild the whole framework with a call to flair_compile_all.
Flair based app
If you want to debug your flair based application code, but don't need to debug the framework itself, you need to edit the file
and add the command add_definitions("-g -O0").