O2 Alibuild with debug information

Dear all,

I want to build O2 with Alibuild but with full debug information. (similar to using -g3 on gcc). How can I do this? Or is it enabled by default?
FYI, I managed to build O2 in the default way with no issues. My environment is Ubuntu 20.04

Thanks in advance…

There are probably multiple ways to achieve this. I personally modify the o2.sh recipe inside alidist and add the following line:

unset CXXFLAGS && CXXFLAGS="-fPIC -std=c++17" && unset CMAKE_BUILD_TYPE && CMAKE_BUILD_TYPE=Debug

A slightly better approach might be to create a standalone debug version of O2 which
is called O2-Debug and which can be compiled without disturbing the production O2 installation:

# copy recipe
cp alidist/o2.sh alidist/o2-debug.sh
# change name of package
sed -i 's/package: O2/package: O2-Debug/' alidist/o2-debug.sh
# insert lines into recipe that make it compile in debug mode
sed -i '/#!\/bin\/sh/ a unset CXXFLAGS && CXXFLAGS="-fPIC -std=c++17" && unset CMAKE_BUILD_TYPE && CMAKE_BUILD_TYPE=Debug' alidist/o2-debug.sh
# make a soft link of O2 git repo to O2-Debug git repo
ln -s O2 O2-Debug
# build O2-Debug
aliBuild build O2-Debug --defaults o2
1 Like

@swenzel thank you for the comprehensive answer.
Second method worked as expected…