TI C2000 compiler for SonarCloud

we have used SonarQube server for one year with the TI C2000 compiler for windows.

We are migrating from our atlassian products from the server to the cloud so this is a good moment for us to also migrate to SonarCloud.

I have signed up to have a free 14 days trial.

The pipes-lines with bitbucket are setup and we can run.

How can we use the TI compiler with Sonarcloud? (C2000-CGT-18_18.12.8.LTS | TI.com)

I see that the build is running under Linux. Is there a way to install the ti compiler for Linux so we can call

build-wrapper-linux-x86-64 --out-dir $BW_OUTPUT build_wrapper_output_directory cl2000.exe

from the file

bitbucket-pipelines.yml

Can this be done? If so how and if not what are the alternatives to get Sonarcloud working for ti C2000.

TI TMS320F280049

Hello @remcotehofstee and welcome to our community!

We have this example on how to configure a bitbucket pipeline: GitHub - sonarsource-cfamily-examples/linux-autotools-bitbucket-sc: An example C++ repository built with GNU Autotools (automake; configure/make) on Linux using BitBucket Pipelines and analyzed on SonarCloud

Assuming you cannot or wish not to keep using Windows, I believe you should be able to use a customed image with your compiler installed in it. Texas Instruments and/or Gitlab may be able to provide more specific help for this step.

Once you have a successful build using your image and this specific compiler, you should be able to perform the analysis. Note, however, that we do not support TI C2000 on Linux using the build wrapper. To mitigate this, you should be able to use a compilation database for the analysis instead. This page explains how to use the compilation database: C/C++/Objective-C | SonarQube Docs

Of course, should you have any issues or questions at this point we’ll be happy to help.

Hello @marco.antognini ,

thank you for your response.

Currently we do the following steps with the SonarQube server.

  1. we build the source using the TI C2000 compiler called by the windows build_wrapper on our local PC. This will generate the needed build_wrapper_output json file.
  2. After this we start the sonar scanner and it will connect with our sonarqube server and perform the analysis.
  3. the analysis can be reviewed at the server
  4. we also have solarlint included in Code Composer (Eclipse IDE of TI)

We are now moving our atlassian products (Jira, Bitbucket) to the cloud so we don’t need a local server for this.

We also wan’t to use SonarCloud instead of SonarQube server.

We want to compile the code in the cloud to generate the output for the sonar scanner. The TI souce cannot be compiled using GCC so it needs to use it’s own compiler.

Question 1: So can step 1 be done by sonarcloud?

Question 2: Is it possible to install the linux (or windows) version of C2000 compiler in the cloud. So we can call the compiler from within the bitbucket-pipelines.yml file.

Question 3: Can we use autotools for this?

Question 4: Or do we need to generate the build_wrapper_output file locally. Add this to the repository. Commit and push it to bitbucket and run sonar scanner in the cloud.

Regards,
Remco

Hello @marco.antognini,

I have downloaded the Linux version of the TI compiler (bin file).

https://www.ti.com/tool/download/C2000-CGT-18

I was able to install the compiler from within the bitbucket-pipelines.yml file.

The compiler is running but the result is an empty build-wrapper-dump.json. So sonar scanner is generating an error beacuse of this.

Under windows I did the same call to the build-wrapper, so with the same arguments with a correct json file as result.

I have added the files and the total log of the pipeline run.

Can you see why the json file is empty?

Regards,
Remco

files.zip (432.5 KB)

Thanks for sharing these specific details and I’m glad you managed to install the compiler in your Linux environment.

Let me first take a step back in case you missed the edit of my first post: C2000 on Linux isn’t supported by the C/C++/Objective-C analyser when using build wrapper as described on C/C++/Objective-C | SonarCloud Docs.

Bitbucket Cloud | SonarCloud Docs states

With Bitbucket Cloud projects the actual analysis is performed in your build environment (cloud CI, local machine, etc.). This means you have to configure your build process to perform the analysis on each build and communicate the results up to SonarCloud.

In other words, when Bitbucket offers the ability to run your pipeline on Windows, you may have little to change. This is unfortunately not yet possible although planned on their side. Cloud Roadmap | Atlassian

However, if you are not bound to Bitbucket you may find Azure DevOps useful: Azure DevOps | SonarCloud Docs explains how to configure SonarCloud to use this platform. You may also be interested in this example: GitHub - sonarsource-cfamily-examples/windows-cmake-azure-sc: An example C++ repository built with CMake on Windows using Azure Pipelines and analyzed on SonarCloud

This doesn’t necessarily mean you’re out of luck with Bitbucket pipelines.

Instead of relying on the build wrapper, you should be able to use a compilation database instead of the build wrapper to drive the analysis. C/C++/Objective-C | SonarCloud Docs describes how to configure the scanner to use the compilation database.

Answering also some of your previous questions:

Can we use autotools for this?

I’m not familiar enough with autotools to answer this question. I suppose it should be rephrased as “Can autotools generate a compilation database?”. Maybe projects such as GitHub - rizsotto/Bear: Bear is a tool that generates a compilation database for clang tooling. can help?

Or do we need to generate the build_wrapper_output file locally. Add this to the repository. Commit and push it to bitbucket and run sonar scanner in the cloud.

Unfortunately, this is unlikely going to work because absolute paths to sources, headers and so on wouldn’t be the same.

I hope this helps.

Hello @marco.antognini ,

This helps a lot and makes it understandable.

For now we are using build_wrapper and sonarscanner local as we did before.

Sonarscanner is now connected with sonarcloud so we can get rid of the local sonarcube server.

In the future, when atlassian has windows pipelines, we will start using this so we can get rid of the local build_wrapper and scanner.

Thanks for your help.

Regards,
Remco

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.