C++ test Report: Could not build Analysis data

becozlahbecozlah Posts: 10

I have a C++ project that is built in Eclipse with GCC/G++ compiler. The project can be compiled successfully and run without problems, but when I try to perform static analysis via cpptestcli, the report generated show the following error:

...
...
...
/ConfigMgr/Common/ConfigParser.cpp

BugDetective checker: could not build analysis data.
File could not be successfully parsed. /ConfigMgr/Common/ConfigParser.cpp

C/C++ code checker: error during parsing file
Error preprocessing file "jenkins/workspace/MyProject/libs/Common/ConfigParser.cpp"
Process exited with code: 1
Error during parsing file "jenkins/workspace/MyProject/libs/Common/ConfigParser.cpp"
...
...
...

what are the possible causes of this problem?

I have check that the file at "jenkins/workspace/MyProject/libs/Common/ConfigParser.cpp" exists, and can be compiled normally in my project with no build errors.

Comments

  • Bogdan CzwartkowskiBogdan Czwartkowski Posts: 127 admin
    edited October 12

    Hi @becozlah ,

    As one of the first steps of static analysis C/C++test needs to preprocess the files to be analyzed. For this, C/C++test will often use and call your compiler, because compiler knows best where to locate all the system headers, and it will provide all the predefined macros.

    From the error message it looks we are unable to successfully preprocess your files, and exit code 1 typically means that the compiler is not on the PATH.

    From what I see, you are running cpptestcli from Jenkins job or pipeline. Jenkins may not have the same environment setup that you have on your local account, as typically Jenkins will run its tasks as a dedicated user.
    Can you verify and double check that Jenkins account or the Jenkins job step you are using to call cpptestcli actually "sees" the compiler?
    The easiest would be to print compiler version (e.g. "g++ -v", "arm-gnu-none-enabi -v", ...) right before calling cpptestcli.

Sign In or Register to comment.