How to Compile Kratos in Debug mode
In order to compile Kratos in Debug mode, you have to edit your compilation script 'configure.sh' by changing the line begining with '-DCMAKE_BUILD_TYPE':
Instead of -DCMAKE_BUILD_TYPE=Release, type:
If your goal is to compile Kratos in Release mode, but containing all the source code information, instead of the previous option type:
This Debug version of the code contains the majority of the code in its pure Debug version, but some parts would be so slow that they are not actually compiled Debug (UBLAS objects). If you want the 100% Debug version of Kratos, including UBLAS, set the following variables, too:
-DKRATOS_DEBUG=ON \ -DDO_NOT_DEFINE_NDEBUG=ON \
but keep in mind that these options are not necessary in general, and make Kratos be really slow!
Exceptionally, in Linux you can also add the compilation flag -D_GLIBCXX_DEBUG. This flag will define the variable _GLIBCXX_DEBUG, which activates many verifications in the STL libraries. Run the code normally and it will crash when it finds some error. This also makes your code very slow. To find out the call stack, it is recommended to use a debugger, because the code crashes and tells you the type of error, but not the location in the code.
Keeping both a Release and a Debug version of Kratos at the same time:
You will notice that switching from one compilation to another takes long, since all the source code is completely re-compiled when you change the compilation mode. A solution to this problem is to compile the code in different folders. This can be done by creating folders similar to the cmake_build folder. For instance, you can create an extra folder called 'cmake_build_debug' by doing this from the main kratos folder:
mkdir cmake_build_debug cp cmake_build/configure.sh cmake_build_debug/configure_debug.sh
Then, edit 'configure_debug.sh' by setting the Debug mode with:
Now you can compile the debug version of Kratos by doing:
cd cmake_build_debug sh configure_debug.sh
And you can compile (if you did not yet) the release version of Kratos by doing:
cd ../cmake_build sh configure.sh
Now, both versions coexist.
When you run a Python script that calls the Kratos library, it will call the last one you compiled.