How to choose different C++ compiler in sonar properties?

SonarQube: 8.3
SonarScanner: 4.3
Installed OS: Windows
Language: C++

I am new to SonarQube and I have successfully installed and run the sample C++ project.
I am using different C++ compilers to build the different projects. I would need to analyze all the projects using SonarQube. Kindly answer me to the below questions,

  1. How to choose different C++ compilers to do the code analysis (GCC, VS, IAR and Xilinx)?
  2. I have installed SonarQube in Windows machine. If I want to analyze the Linux project, how to generate build wrapper JSON and how to run the scanner in Windows machine?
  3. Do we have plugin support for Xilinx SDK IDE and IAR workbench?

Hi @arumugamcv,

You don’t need to choose a particular compiler; just use the compiler you would normally use to build your code, add the build wrapper to your build and analyze using the SonarQube scanner. Note that we only support the compilers listed here.

You should run the scan wherever your code is built (i.e. scan your Linux code on a Linux machine) but you can still keep the SonarQube server running on Windows. Simply provide sonar.host.url to the scanner to point it to your SonarQube server.
To scan on Linux you’ll need to download the Build Wrapper for Linux; the URL is in our documentation

Our IDE plugin, SonarLint, supports VIsual Studio, VS Code, Eclipse and IntelliJ.

I hope this helps answer your questions!

Regards,

Cameron.

Thanks Cameron for your detailed reply. Most of my doubts got clarified.
As per your documentation, SonarQube does not support Xilinx C++ Compiler. Am I right?
As you have mentioned, I can keep running SonarQube server on Windows machine and continue scanning on Linux machine by pointing scanner to SonarQube server URL. In that case, should I change the default URL? If so, how to change the URL?

Thanks,
Arumugam.

Hi @arumugamcv,

Xilinx is not officially supported, but I believe Xilinx is based on GCC (?) so you could try compiling your code with GCC, which we do support, or even experiment with the Xilinx compiler to see if it’s sufficiently GCC-like that the build wrapper picks up the data it needs. No guarantees, though :slight_smile:

Regarding the URL:

  • Your Windows machine must have an IP address, so as a starting point you could pass the IP address and port to the scanner in sonar.host.url.
  • Or, if your Windows machine has a host name, simply pass that and the port. At the same time go to the main SonarQube Administration page and change your Server base URL to match

Regards,

Cameron.