Version 2 (modified by 6 years ago) ( diff ) | ,
---|
Build system
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.
Helper scripts
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.
- flair_compile_all.sh: compile libs, tools and demos with all available toolchains
- cmake_codelite_outofsource.sh: configure a project for CodeLite for all available toolchains
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.
Out of source build
The recommended usage is to build everything out of source, in order to keep your svn repositories clean. Helper scripts will build everything in $FLAIR_ROOT/flair-build directory.
Compile Flair libraries, tools and demos
To compile all Fl-AIR stuffs, you can execute the dedicated script:
$ $FLAIR_ROOT/flair-dev/scripts/flair_compile_all.sh
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.
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.
Full framework
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
$ /opt/robomap3/<version>/<arch>/toochain.cmake
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
<app>/build/CMakeFiles/<app>.dir/flags.cmake
and add the command add_definitions("-g -O0").