Build-wrapper LD_PRELOAD issue on Linux using ccstudio build

Hi!
We are currently evaluating SonarQube. We want to be able to analyze a C++ project built and deployed with ccstudio, using the TI TMS320C6x compiler cl6x.

This is the setup we tested on:

  • OS: Linux, 5.4.0-89-generic #100~18.04.1-Ubuntu
  • SonarQube: 9.1.0.47736, Developer license
  • build-wrapper: version 6.26 (linux-x86)
  • Code composer: 9.2.0.00013
  • Compiler: TMS320C6x C/C++ Compiler v7.4.24

We tested the workflow with an example project found here. Everything went right during the build-wrapper phase and we could analyze with the scanner afterward.
However, when trying to gather our real project’s information with build-wrapper, I got some LD_PRELOAD issue in the middle of my build (I obfuscated some person/project names in the following logs):

build-wrapper-linux-x86-64 --out-dir bw-output ccstudio -noSplash -data <my_workspace> -application com.ti.ccstudio.apps.projectBuild -ccs.projects <my_project>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CCS headless build starting... [Wed Nov 10 15:22:25 CET 2021] 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

================================================================================
Pre processing...


================================================================================
Building...


**** Build of configuration Debug for project <project_1> ****

/home/m<name/ti/ccs920/ccs/utils/bin/gmake -k -j 8 all -O 
 
build-wrapper: unexpected LD_PRELOAD=/home/myname/tools/sonarqube-9.1.0.47736/tools/build-wrapper-linux-x86/libinterceptor-x86_64.so

**** Build Finished ****

**** Build of configuration Debug for project <project2> ****

/home/david/ti/ccs920/ccs/utils/bin/gmake -k -j all -O 
 
build-wrapper: unexpected LD_PRELOAD=/home/myname/tools/sonarqube-9.1.0.47736/tools/build-wrapper-linux-x86/libinterceptor-x86_64.so

**** Build Finished ****

================================================================================
CCS headless build complete! 0 out of 1 projects have errors.

The two results file build-wrapper-dump.json and build-wrapper.log are created but the scanner analysis does not produce any results afterward, even when specifying some subset of our sources. The JSON mentions GCC as the compiler, although we are using TI Cl6c one.

When running the build command without the build-wrapper, we got the whole compilation trace, listing all our cpp files.

I read on the C/C++ doc that TI compilers are only supported on Windows and MacOS, but I was not sure about this sentence.

Anyway, if someone has encountered the same issue or is working with a similar environment, let me know!

In the meantime, have a nice day!

David

Hello @dtn-reds,

The reason for which they are not supported on Linux is that their binaries are usually statically linked and the build-wrapper uses dynamic libraries(LD_PRELOAD) to observe compiler invocations.

Here it seems that you are invoking the raw compilation commands so build-wrapper should be able to get them.

We support a compilation database(which can be generated by many tools) as an alternative to build-wrapper to unblock such cases.
Have a look at this blog post and the documentation:

Thanks,