SonarQube 8.9.8 LTS cannot find IAR system includes

Versions:

  • SonarQube Enterprise Edition 8.9.8 (build 54436)
  • SonarScanner 4.7
  • IAR Embedded Workbench 9.30.1

When running an analysis of an IAR Embedded Workbench project with the Build Wrapper/SonarScanner, I see the following error message:

The analyzer was not able to find file
intrinsics.h
included from file C:\GitLab-Runner\build\b7yqh3bW\0\tardigrada\module\test-project-sonarqube\src\main.cpp
This impacts the quality of the analysis and leads to inaccurate results.

This file is an IAR header file, stored in location $TOOLKIT_DIR$\inc\c\aarch32 and is present on the machine.

The result of the analysis itself shows a similar problem: ‘no type named ‘byte’ in namespace ‘std’ (cpp:ParsingError) . The definition for std::byte is in the header file cstddef, which is also an IAR header file (location $TOOLKIT_DIR$\inc\libcpp).

I created a minimal sample project that reproduces the issue and added the Sonar Scanner debug output together with the sonar-cfamily-reproducer.zip.
In order to use std::byte, the IAR project is configured with the recently introduced Libc++ (C/C++17 runtime library).

test-project-sonarqube.zip (21.5 KB)
Full_SonarScannerOutput.txt (69.2 KB)
sonar-cfamily-reproducer.zip (34.3 KB)

Hello @matgug and welcome to our community!

Thanks for the report, it’s really valuable, and the minimal project helps.

Currently, we don’t support this version of IAR that was released recently. I’ve opened a ticket to improve this: [CPP-3769] - Jira.

In the meantime, you should be able to work around the issue, given it’s related to include paths. You can use the --no_system_include option to turn off automatic detection of the system include paths and use -I to manually list the relevant paths.

I hope this helps

Hi @marco.antognini
Thank you for the prompt confirmation and for creating the Jira ticket!

Can you estimate by when this should be resolved? It would be very important for us that this can be included in the next LTS version at the latest, as the problems cause many subsequent errors (false-positive issues) and the workaround with --no_system_include can also lead to problems. Our company relies on the LTS versions and waiting until mid-2024 would be very difficult for us.

Thanks,
Mathias

Hello @matgug,

It turns out that one of my colleagues was very swift in implementing a fix. It will be available in the next release and the next LTS.

Cheers

Hi @marco.antognini ,

That’s great news! You have an impressive pace, thank you very much.

Regards
Mathias

1 Like