Issues with TIClang and build wrapper

Version information:
SonarScanner 4.5.0.2216
Java 11.0.3 AdoptOpenJDK (64-bit)
Linux 5.10.0-20-cloud-amd64 amd64

TI clang version:
TI Arm Clang Compiler 2.1.2.LTS
Target: arm-ti-none-eabi
Thread model: posix

I am working on a project that involves many embedded targets. Most of these targets are compiled using a variant of gcc, but recently a new TI target has been added that is compiled using TI’s own TIClang. None of the gcc have caused any issues on the CI server, but the TIClang does. When running build-wrapper, the resulting build-wrapper-dump.json file is empty (not completely, but it does not contain any useful information) and SonarScanner cannot continue.

Our sonarqube script looks like this (slightly modified to hide sensitive information):

    # Setup: Copy script to /opt/bin (necesary for SonarQube)
    - sudo cp ${CI_PROJECT_DIR}/tools/${TARGET}.sh /opt/bin/${TARGET}
    - ls /opt/bin/ -l
    # build
    - source /etc/profile.d/sonarqube.sh
    - build-wrapper-linux-x86-64 --out-dir .sonar/ /opt/bin/${TARGET}
    - cd ${CI_PROJECT_DIR}
    # unittest coverage
    - tools/unittest.sh --coverage
    - gcovr -k
    
    # run sonarqube
    - sonar-scanner -Dsonar.projectKey=${PROJECT_NAME}

Each target has a bash script in tools/${TARGET}.sh that invokes a specific Makefile for each target. A lot of the code is shared between the targets, so the only difference between them (except being different mcu’s) is the compiler. The gcc targets will run fine all the way through, but when the ticlang target gets to the - sonar-scanner -Dsonar.projectKey=${PROJECT_NAME} step, the following output is logged:

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:36.698s
INFO: Final Memory: 148M/497M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found empty. Please make sure that:
  * you are using the latest version of the build-wrapper and the CFamily analyzer
  * your compiler is supported
  * you are wrapping your build correctly
  * you are wrapping a full/clean build
  * if you are building your project inside a Docker container, build-wrapper is wrapping the build process inside the container and not wrapping the external Docker process
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:491)
	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
Fail

Does anybody have any experience with Ticlang and sonarqube? Thanks

Hey there.

What version of SonarQube are you using? You can find this in the footer of your SonarQube instance.

Hello. The footer claims the following:

  • Developer Edition - Version 9.9 (build 65466)

Hi @user2213 ,

tiarmclang support has been added recently and it is available starting from SonarQube 10.0. See the related ticket: [CPP-4089] - Jira.

I would recommend one of these two options:

  • upgrade to SonarQube 10.0
  • rename the compiler binary from tiarmclang to tiarm-clang and the build-wrapper will be able to capture its invocation
1 Like

Thank you! Renaming the binary seemed to work. So simple…

Great, thank you for the confirmation.

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