Error during SonarScanner execution (CFamily) Java Exception

Must-share information:

  • which versions are you using
    • SonarQube Enterprise Edition Version 8.4.1 (build 35646)
    • Scanner 4.4.0.2170
    • Build Wrapper downloaded directly from our SonarQube server at {SonarQube URL}/static/cpp/build-wrapper-linux-x86.zip, build-wrapper, version 6.11 (linux-x86)
    • Plugins:
      • SonarCSS 1.2.0.1325 (cssfamily)
      • Svn 1.10.0.1917 (scmsvn)
      • SonarPLSQL 3.4.1.2576 (plsql)
      • SonarScala 1.5.0.315 (sonarscala)
      • C# Code Quality and Security 8.9.0.19135 (csharp)
      • Vulnerability Analysis 8.4.0.2759 (security)
      • Java Code Quality and Security 6.5.1.22586 (java)
      • SonarHTML 3.2.0.2082 (web)
      • SonarFlex 2.5.1.1831 (flex)
      • SonarXML 2.0.1.2020 (xml)
      • SonarTS 2.1.0.4359 (typescript)
      • VB.NET Code Quality and Security 8.9.0.19135 (vbnet)
      • SonarSwift 4.2.2.77 (swift)
      • CFamily Code Quality and Security 6.11.0.19130 (cpp)
      • Python Code Quality and Security 2.13.0.7236 (python)
      • JaCoCo 1.1.0.898 (jacoco)
      • RPG Code Quality 2.4.0.2183 (rpg)
      • SonarGo 1.6.0.719 (go)
      • SonarKotlin 1.5.0.315 (kotlin)
      • SonarPLI 1.10.0.1880 (pli)
      • SonarTSQL 1.4.0.3334 (tsql)
      • SonarVB6 2.6.0.1875 (vb)
      • SonarApex 1.7.0.883 (sonarapex)
      • SonarJS 6.2.1.12157 (javascript)
      • SonarRuby 1.5.0.315 (ruby)
      • Vulnerability Rules for C# 8.4.0.2759 (securitycsharpfrontend)
      • Vulnerability Rules for Java 8.4.0.2759 (securityjavafrontend)
      • License for SonarLint 8.4.1.35646 (license)
      • COBOL Code Quality 4.5.1.4460 (cobol)
      • Vulnerability Rules for Python 8.4.0.2759 (securitypythonfrontend)
      • Git 1.12.0.2034 (scmgit)
      • PHP Code Quality and Security 3.5.0.5655 (php)
      • SonarABAP 3.8.0.2034 (abap)
      • Vulnerability Rules for PHP 8.4.0.2759 (securityphpfrontend)
    • and any relevant extension
      • Running in a container
      • CentOS Linux release 8.2.2004
      • Java 11 OpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS)
      • cpack version 3.11.4
      • gcc version 8.3.1 20191121 (Red Hat 8.3.1-5)
  • what are you trying to achieve
    • I am trying to implement the build wrapper and scanner in an existing project that is a template project that developers will be able to fork and begin the process of making an application that will integrate with our CICD pipeline.
  • what have you tried so far to achieve this
    • The existing project has a compile.sh that will, depending on if BUILD_RPM is set to true, compile the project as an rpm using CPack or, if not, just a normal build. If BUILD_RPM is set to false, the build wrapper and build pass, as well as the scanning of the build wrapper output. The results are viewable in the WEBUI, success! If BUILD_RPM is set to true, however, the build and wrapper pass but the scan of the build wrapper output fails with a java error. The only difference between the two is that the former calls ‘build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory make’ while the latter calls ‘build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory make package’. Make package relies on CPack to create the rpm. Are there any known issues with using Build Wrapper with CPack?

I have saved the debug output of sonar-scanner in the failed case.

Hello @christopher.t.boyer,

I sent you a private message where you can share the output.

Thanks,

Thanks for your help @Abbas_Sabra. The failure during scanning was caused by building and then copying the build directory and scanning in a different absolute/path. Our reasons for doing this are because building and scanning happen in different stages and are handled by different containers. Ultimately, recreating the original absolute/path of the build artifacts did the trick.

2 Likes

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