Need help with O2CodeChecker


I find the state of the o2codechecker pretty confusing.

First, the output of the o2codechecker results in the PR check is very tedious to browse : would it be possible to highlight the errors in some way ? Or to add some doc somewhere instructing what to look for ?

Then, trying to run it locally (to avoid using the CI as a trial and error tool for checking) is also not completely trivial.

My attempt so far (on a Mojave Mac) :

  1. aliBuild --defaults o2 build o2codechecker => wait for Clang7 to be compiled and then got lots of errors for all over the place in O2.
  2. trying to narrow to “my” classes :

cd /Users/laurent/alice/sw/BUILD/O2-latest/O2 -clang-tidy-binary $HOME/alice/sw/osx_x86-64/o2codechecker/latest/bin/O2codecheck “-checks=-,alice” “Detectors/MUON/*”

got a lot of errors regarding standard headers :

Error while processing /Users/laurent/alice/O2/Detectors/MUON/MCH/Mapping/test/src/CathodeSegmentation.cxx.
/usr/local/opt/boost/include/boost/config/detail/select_stdlib_config.hpp:18:12: error: ‘cstddef’ file not found [clang-diagnostic-error]

Any idea what stupid mistake(s) I’m doing here ?


Hi Laurent,

You can restrict the codechecker to run on changed files only. Please take a look in Utilities/Tools/ inside the O2 repository (we should really link this file in the main README).

I will try to take a look concerning the header problems. This should really not happen.

Indeed the O2 repo is not globally in a green state. The reasons are: Long period where this check was not executed at all and we recently had to move to a newer version of clang-tidy which enabled some more checks.
We need to take a decision whether to keep the additional checks or disable them. Waiting for WP3 to take decision. Most of the failures can be fixed completely automatically.

Hi Sandro,

Coming back to this issue with the standard headers.

A simple reproducer is below. It’s on a Mojave Mac (from a clean install, w/o Xcode GUI installed, SIP enabled).

BTW, do I understand correctly that O2codecheck is clang-tidy with a couple of Alice specifics checks ? (otherwise my check below doesn’t make as much sense)

// test.cxx
#include <iostream>
int main()
  double x = 42.42;
  int i = (int)(x + 0.5);
  std::cout << i << "\n";
  return 0;
~/tmp $ clang-tidy test.cxx --  -I$(xcrun --show-sdk-path)/usr/include
~/tmp $ module list
No Modulefiles Currently Loaded.
~/tmp $ module load alice o2codechecker
~/tmp $ O2codecheck test.cxx --  -I$(xcrun --show-sdk-path)/usr/include
1 error generated.
Error while processing /Users/laurent/tmp/test.cxx.
/Users/laurent/tmp/test.cxx:1:10: error: 'iostream' file not found [clang-diagnostic-error]
#include <iostream>
Found compiler error(s).