Issues with TIClang and build wrapper

Version information:
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/
    - build-wrapper-linux-x86-64 --out-dir .sonar/ /opt/bin/${TARGET}
    - cd ${CI_PROJECT_DIR}
    # unittest coverage
    - tools/ --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: ------------------------------------------------------------------------
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(
	at com.sonar.cpp.plugin.CFamilySensor.execute(
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(
	at org.sonar.core.platform.SpringComponentContainer.startComponents(
	at org.sonar.core.platform.SpringComponentContainer.execute(
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(
	at org.sonar.core.platform.SpringComponentContainer.startComponents(
	at org.sonar.core.platform.SpringComponentContainer.execute(
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(
	at org.sonar.core.platform.SpringComponentContainer.startComponents(
	at org.sonar.core.platform.SpringComponentContainer.execute(
	at org.sonar.batch.bootstrapper.Batch.doExecute(
	at org.sonar.batch.bootstrapper.Batch.execute(
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(
	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(
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.execute(
	at org.sonarsource.scanner.cli.Main.main(
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

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.