SonarQube Developer Edition: 7.4.0.18908
build-wrapper: 5.1 (linux-x86)
Scanner: 3.2.0.1227
SonarCFamily: 5.1.1 (build 10386)
embedded c compiler: powerpc-eabivle-gcc(4.9.4)
Host environment: Ubuntu 16.04.1 x86_64
Hi,
I am now looking into the features of sonarqube-developer-7.4 and trying to make sure that it is suitable for us.
The evaluation key valid for 2 weeks already be installed.
I created a simple embedded C project to do analyze, but seems that it failed to produce the desired results.
I guess the build-wrapper didn’t catch those intermediate results. So that SonarQube scanner did not cover the C source file.
I have no idea what should do for a successful analyze. Any help will be greatly appreciated.
The operating environment and steps are as follows.
The project use MPC5748G which developed by NXP Company as the microprocessor and S32DS for Power V1.2 as IDE.
The contents of main sorce file main.c as follows, As you can see, it is very simply and have some obvious defects in it.
#include "derivative.h" /* include peripheral declarations */
#include <stdlib.h>
#include <string.h>
extern void xcptn_xmpl(void);
int main(void)
{
volatile int counter = 0;
xcptn_xmpl (); /* Configure and Enable Interrupts */
char *p = (char *)malloc(100);
strcpy(p,"hello");
free(p);
if(NULL != p)
{**_
strcpy(p,"world");
}**_
/* Loop forever */
for(;;)
{
counter++;
}
}
I do analyze with the steps as follows:
First, I use the command below to produce intermediate directory:
build-wrapper-linux-x86-64 --out-dir ../bw-outputs make clean all
The source file can be compiled successfully using the makefile which is autogenerated by IDE. but I can’t find anything useful in ../bw-outputs/build-wrapper-dump.json
.
The contents of output file build-wrapper-dump.json
as follows:
# (C) SonarSource SA, 2014-2017, info@sonarsource.com
# All SONARSOURCE programs and content are copyright protected.
# SONARSOURCE and SONARQUBE are trademarks of SonarSource SA. All rights are expressly reserved.
#
# This file is designed exclusively for use with the SONARSOURCE C / C++ / Objective-C Plugin.
# It may not be used in connection with any other software.
# Any other use is prohibited by law and may be grounds for immediate termination of your License.
{
"version":0,
"captures":[
]}
you can find log file build-wrapper.log as attachements.
Second,I run command below to do scanner:
sonar-scanner
The contents of scanner config file sonar-project.properties
as follows:
sonar.projectKey=test
sonar.host.url=http://localhost:9000
sonar.login=d63cbf3f7be95520ed3f95cba8ffd480f6973dd9
sonar.projectName=Example of C/C++ Scan (with BuildWrapper)
sonar.projectVersion=1.0
sonar.sources=./
sonar.cfamily.build-wrapper-output=bw-outputs
sonar.sourceEncoding=UTF-8
the terminal output is sonar-scanner-terminal-ouput.txt
as attachements.
Finally, I check the analyze result on webpage, the results are shown below:
sonar-scanner-terminal-ouput.txt (28.9 KB)
build-wrapper.log.txt (46.4 KB)
jeremy.xiang
Any help will be greatly appreciated.