When using -fdiagnostics-color in my compiler options, I receive colorized output in the compiler output (gcc and clang). This also works with ninja when I run on my local computer. Doing the same in a gitlab-CI, the colors are stripped away. Is there a way to get colored compiler output in a gitlab CI?
I tried make instead of ninja and there the colors appear.
The problem comes from ninja's output handling (Ninja must interfere with the output to avoid that concurrent processes mix their outputs). While gcc/clang even in the gitlab-CI issue colored output, ninja determines if the output goes to a usual user terminal or a logfile and removes the colors. This is discussed on the ninja github page:
for the smart-terminal detection and color preservation: issue pull request
and somewhat related: another issue another pull request
EDIT: as of this commit (i.e. ninja 1.9.0), the environment variable CLICOLOR_FORCE can be used to disable stripping color codes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With