Analysing a C++ project, using bazel : "build-wrapper-dump.json" file was found empty

  • SonarQube Developer v9.4
  • SonarScanner v4.6.2.2472
  • Build-wrapper v6.32 (linux-x86)
  • Ubuntu 18

  • I’m having difficulties analysing a C++ project, using bazel as my build system.
  • This is my sonar-project.properties file (editing host.url, login)
    sonar.projectKey=security-hub
    sonar.sources=cpp
    sonar.cfamily.build-wrapper-output=build_output
    sonar.cfamily.threads=4
    sonar.cfamily.cache.enabled=false
    sonar.host.url=<my-host-url>
    sonar.login=<my-token>
  • On running build-wrapper-linux-x86-64 --out-dir build_output bazel build //security/security-hub/... --config linux64 --config beta --experimental_scale_timeouts=3.0 Build completes successfully.

  • On running sonar-scanner this is my output


    INFO: Scanner configuration file: /opt/sonarqube/sonar-scanner-4.6.2.2472-linux/conf/sonar-scanner.properties
    INFO: Project root configuration file: /home/ess/fold/security/security-hub/sonar-project.properties
    INFO: SonarScanner 4.6.2.2472
    INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
    INFO: Linux 4.19.186-nn10-server amd64
    INFO: User cache: /home/ess/.sonar/cache
    INFO: Scanner configuration file: /opt/sonarqube/sonar-scanner-4.6.2.2472-linux/conf/sonar-scanner.properties
    INFO: Project root configuration file: /home/ess/fold/security/security-hub/sonar-project.properties
    INFO: Analyzing on SonarQube server 9.4.0
    INFO: Default locale: "en_US", source code encoding: "UTF-8"
    INFO: Load global settings
    INFO: Load global settings (done) | time=120ms
    INFO: Server id: 86E1FA4D-AX_PMAmSHIM6QPL68GUj
    INFO: User cache: /home/ess/.sonar/cache
    INFO: Load/download plugins
    INFO: Load plugins index
    INFO: Load plugins index (done) | time=72ms
    INFO: Load/download plugins (done) | time=349ms
    INFO: Loaded core extensions: developer-scanner
    INFO: Process project properties
    INFO: Process project properties (done) | time=12ms
    INFO: Execute project builders
    INFO: Execute project builders (done) | time=2ms
    INFO: Project key: security-hub
    INFO: Base dir: /home/ess/fold/security/security-hub
    INFO: Working dir: /home/ess/fold/security/security-hub/.scannerwork
    INFO: Load project settings for component key: 'security-hub'
    INFO: Load project settings for component key: 'security-hub' (done) | time=28ms
    INFO: Load project branches
    INFO: Load project branches (done) | time=24ms
    INFO: Load project pull requests
    INFO: Load project pull requests (done) | time=15ms
    INFO: Load branch configuration
    INFO: Load branch configuration (done) | time=5ms
    INFO: Load quality profiles
    INFO: Load quality profiles (done) | time=84ms
    INFO: Load active rules
    INFO: Load active rules (done) | time=511ms
    INFO: Load project repositories
    INFO: Load project repositories (done) | time=20ms
    INFO: Indexing files...
    INFO: Project configuration:
    INFO: 243 files indexed
    INFO: 0 files ignored because of scm ignore settings
    INFO: Quality profile for c: Sonar way+N
    INFO: Quality profile for cpp: Sonar way+N
    INFO: Quality profile for json: Sonar way
    INFO: Quality profile for py: Sonar way+N
    INFO: Quality profile for xml: Sonar way+N
    INFO: ------------- Run sensors on module security-hub
    INFO: Load metrics repository
    INFO: Load metrics repository (done) | time=24ms
    INFO: ITS Plugin: registered 1 rules
    INFO: ITSRule: created
    INFO: Sensor Inclusive Terminology Sensor (ITS) [itsscannerjava]
    INFO: loading ITS rules from https://itsx-resources.s3.us-west-2.amazonaws.com/public/its-rules.json
    INFO: loaded 22 ITS rules in 1535 ms
    INFO: /home/ess/fold/security/security-hub/cpp/src/kafka/KafkaConsumer.cpp:96 - Offensive term: disable, replace with: deactivate
    INFO: Sensor Inclusive Terminology Sensor (ITS) [itsscannerjava] (done) | time=4565ms
    INFO: Sensor IaC CloudFormation Sensor [iac]
    INFO: 0 source files to be analyzed
    INFO: 0/0 source files have been analyzed
    INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=33ms
    INFO: Sensor C# Project Type Information [csharp]
    INFO: Sensor C# Project Type Information [csharp] (done) | time=3ms
    INFO: Sensor C# Analysis Log [csharp]
    INFO: Sensor C# Analysis Log [csharp] (done) | time=38ms
    INFO: Sensor C# Properties [csharp]
    INFO: Sensor C# Properties [csharp] (done) | time=1ms
    INFO: Sensor HTML [web]
    INFO: Sensor HTML [web] (done) | time=8ms
    INFO: Sensor XML Sensor [xml]
    INFO: 2 source files to be analyzed
    INFO: 2/2 source files have been analyzed
    INFO: Sensor XML Sensor [xml] (done) | time=272ms
    INFO: Sensor Text Sensor [text]
    INFO: 189 source files to be analyzed
    INFO: 189/189 source files have been analyzed
    INFO: Sensor Text Sensor [text] (done) | time=8ms
    INFO: Sensor VB.NET Project Type Information [vbnet]
    INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
    INFO: Sensor VB.NET Analysis Log [vbnet]
    INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=34ms
    INFO: Sensor VB.NET Properties [vbnet]
    INFO: Sensor VB.NET Properties [vbnet] (done) | time=1ms
    INFO: Sensor Python Sensor [python]
    WARN: Your code is analyzed as compatible with python 2 and 3 by default. This will prevent the detection of issues specific to python 2 or python 3. You can get a more precise analysis by setting a python version in your configuration via the parameter "sonar.python.version"
    INFO: Starting global symbols computation
    INFO: 3 source files to be analyzed
    INFO: 3/3 source files have been analyzed
    INFO: Starting rules execution
    INFO: 3 source files to be analyzed
    INFO: 3/3 source files have been analyzed
    INFO: Sensor Python Sensor [python] (done) | time=769ms
    INFO: Sensor Cobertura Sensor for Python coverage [python]
    INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=17ms
    INFO: Sensor PythonXUnitSensor [python]
    INFO: Sensor PythonXUnitSensor [python] (done) | time=4ms
    INFO: Sensor JaCoCo XML Report Importer [jacoco]
    INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
    INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
    INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
    INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
    INFO: javasecurity:S5131 is not activated in quality profile: skipping execution of thymeleaf sensor.
    INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=0ms
    INFO: Sensor Python HTML templates processing [securitypythonfrontend]
    INFO: pythonsecurity:S5131 is not activated in quality profile: skipping execution of Python HTML templates sensor.
    INFO: Sensor Python HTML templates processing [securitypythonfrontend] (done) | time=0ms
    INFO: Sensor Serverless configuration file sensor [security]
    INFO: 0 Serverless function entries were found in the project
    INFO: 0 Serverless function handlers were kept as entrypoints
    INFO: Sensor Serverless configuration file sensor [security] (done) | time=7ms
    INFO: Sensor AWS SAM template file sensor [security]
    INFO: Sensor AWS SAM template file sensor [security] (done) | time=2ms
    INFO: Sensor CFamily [cpp]
    INFO: CFamily plugin version: 6.32.0.44918
    INFO: Using build-wrapper output: /home/ess/fold/security/security-hub/build_output/build-wrapper-dump.json
    INFO: Available processors: 4
    INFO: Using 4 threads for analysis according to value of "sonar.cfamily.threads" property.
    INFO: Cache is explicitly disabled: Optional[false]
    INFO: PCH: unique=0 use=0 (forceInclude=0,throughHeader=0,firstInclude=0) out of 0 (forceInclude=0,throughHeader=0)
    INFO: SE: 0 out of 0
    INFO: Z3 refutation rate: 0 out of 0
    INFO: Subprocess(es) done in 14ms
    INFO: 0 compilation units analyzed
    INFO: ------------------------------------------------------------------------
    INFO: EXECUTION FAILURE
    INFO: ------------------------------------------------------------------------
    INFO: Total time: 17.057s
    INFO: Final Memory: 31M/107M
    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:186)
            at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
            at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
            at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
            at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:81)
            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:392)
            at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:388)
            at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:357)
            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:134)
            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.
  • These are the contents of my build wrapper output directory
    • build-wrapper-dump.json
# (C) SonarSource SA, 2014-2022, info@sonarsource.com
# All SONARSOURCE programs and content are copyright protected.
# SONARSOURCE and SONARQUBE are trademarks of SonarSource SA. All rights are expressly reserved.
#
# This file is designed exclusively for use with the SONARSOURCE C / C++ / Objective-C Plugin.
# It may not be used in connection with any other software.
# Any other use is prohibited by law and may be grounds for immediate termination of your License.
{
"version":"6.32",
"captures":[
]}
  • build-wrapper.log
Fri Apr 08 02:31:52 2022: build-wrapper, version 6.32 (linux-x86)
Fri Apr 08 02:31:52 2022: System name: Linux Nodename: dev Release: 4.19.186-nn10-server Version: #nn10 SMP PREEMPT Thu Jun 24 12:56:37 UTC 2021 Machine: x86_64
Fri Apr 08 02:31:52 2022: socket path: /tmp/build-wrapper-socket.MocgQf
Fri Apr 08 02:31:52 2022: dynamic library found: /opt/build_wrapper/build-wrapper-linux-x86/libinterceptor-i686.so
Fri Apr 08 02:31:52 2022: dynamic library found: /opt/build_wrapper/build-wrapper-linux-x86/libinterceptor-x86_64.so
Fri Apr 08 02:31:52 2022: dynamic library found: /opt/build_wrapper/build-wrapper-linux-x86/libinterceptor-haswell.so
Fri Apr 08 02:31:52 2022: cwd: </home/ess/fold/security/security-hub>
Fri Apr 08 02:31:52 2022: command executed as: <build-wrapper-linux-x86-64 --out-dir build_output>
Fri Apr 08 02:31:52 2022: out-dir absolute path: </home/ess/fold/security/security-hub/build_output>
Fri Apr 08 02:31:52 2022: command line received: <bazel build //security/security-hub/... --config linux64 --config beta --experimental_scale_timeouts=3.0>
Fri Apr 08 02:31:52 2022: env 0: <SHELL=/bin/bash>
Fri Apr 08 02:31:52 2022: env 1: <COLORTERM=truecolor>
Fri Apr 08 02:31:52 2022: env 2: <TERM_PROGRAM_VERSION=1.64.2>
Fri Apr 08 02:31:52 2022: env 3: <JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/>
Fri Apr 08 02:31:52 2022: env 4: <PWD=/home/ess/fold/security/security-hub>
Fri Apr 08 02:31:52 2022: env 5: <LOGNAME=ess>
Fri Apr 08 02:31:52 2022: env 6: <QT_QPA_PLATFORMTHEME=appmenu-qt5>
Fri Apr 08 02:31:52 2022: env 7: <VSCODE_GIT_ASKPASS_NODE=/home/ess/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/node>
Fri Apr 08 02:31:52 2022: env 8: <MOTD_SHOWN=pam>
Fri Apr 08 02:31:52 2022: env 9: <HOME=/home/ess>
Fri Apr 08 02:31:52 2022: env 10: <LANG=en_US.UTF-8>
Fri Apr 08 02:31:52 2022: env 11: <LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:>
Fri Apr 08 02:31:52 2022: env 12: <GIT_ASKPASS=/home/ess/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/extensions/git/dist/askpass.sh>
Fri Apr 08 02:31:52 2022: env 13: <SSH_CONNECTION=10.104.41.235 61567 10.102.80.17 22>
Fri Apr 08 02:31:52 2022: env 14: <VSCODE_GIT_ASKPASS_EXTRA_ARGS=>
Fri Apr 08 02:31:52 2022: env 15: <LESSCLOSE=/usr/bin/lesspipe %s %s>
Fri Apr 08 02:31:52 2022: env 16: <TERM=xterm-256color>
Fri Apr 08 02:31:52 2022: env 17: <LESSOPEN=| /usr/bin/lesspipe %s>
Fri Apr 08 02:31:52 2022: env 18: <USER=ess>
Fri Apr 08 02:31:52 2022: env 19: <VSCODE_GIT_IPC_HANDLE=/tmp/vscode-git-76bd9b2b6c.sock>
Fri Apr 08 02:31:52 2022: env 20: <SHLVL=1>
Fri Apr 08 02:31:52 2022: env 21: <S_COLORS=auto>
Fri Apr 08 02:31:52 2022: env 22: <SSH_CLIENT=10.104.41.235 61567 22>
Fri Apr 08 02:31:52 2022: env 23: <VSCODE_GIT_ASKPASS_MAIN=/home/ess/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/extensions/git/dist/askpass-main.js>
Fri Apr 08 02:31:52 2022: env 24: <XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop>
Fri Apr 08 02:31:52 2022: env 25: <BROWSER=/home/ess/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/bin/helpers/browser.sh>
Fri Apr 08 02:31:52 2022: env 26: <PATH=/usr/lib/jvm/java-11-openjdk-amd64//bin:/opt/build_wrapper/build-wrapper-linux-x86/:/usr/lib/jvm/java-11-openjdk-amd64//bin:/opt/build_wrapper/build-wrapper-linux-x86:/usr/lib/jvm/java-11-openjdk-amd64//bin:/opt/build_wrapper/build-wrapper-linux-x86:/home/ess/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326/bin/remote-cli:/home/ess/bin:/home/ess/.local/bin:/usr/lib/jvm/java-11-openjdk-amd64//bin:/opt/build_wrapper/build-wrapper-linux-x86:/home/ess/bin:/home/ess/.local/bin:/usr/lib/jvm/java-11-openjdk-amd64//bin:/opt/build_wrapper/build-wrapper-linux-x86:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/sonarqube/sonar-scanner-4.6.2.2472-linux/bin:/build/apps/bin:/opt/sonarqube/sonar-scanner-4.6.2.2472-linux/bin:/build/apps/bin>
Fri Apr 08 02:31:52 2022: env 27: <MAIL=/var/mail/ess>
Fri Apr 08 02:31:52 2022: env 28: <OLDPWD=/opt/build_wrapper/build-wrapper-linux-x86>
Fri Apr 08 02:31:52 2022: env 29: <TERM_PROGRAM=vscode>
Fri Apr 08 02:31:52 2022: env 30: <VSCODE_IPC_HOOK_CLI=/tmp/vscode-ipc-3e460c21-543d-48e2-bc23-ab9cc46b5cd8.sock>
Fri Apr 08 02:31:52 2022: env 31: <_=/opt/build_wrapper/build-wrapper-linux-x86/build-wrapper-linux-x86-64>
Fri Apr 08 02:31:52 2022: executing: <bazel build //security/security-hub/... --config linux64 --config beta --experimental_scale_timeouts=3.0>
Fri Apr 08 02:31:52 2022: initializing json file
Fri Apr 08 02:31:52 2022: process created with pid: 12962
Fri Apr 08 02:31:52 2022: parent pid: 12961
Fri Apr 08 02:31:52 2022: working directory: </home/ess/fold/security/security-hub>
Fri Apr 08 02:31:52 2022: executable: </opt/build_wrapper/build-wrapper-linux-x86/build-wrapper-linux-x86-64>
Fri Apr 08 02:31:52 2022: argv[0]: <build-wrapper-linux-x86-64>
Fri Apr 08 02:31:52 2022: argv[1]: <-c>
Fri Apr 08 02:31:52 2022: argv[2]: <>
Fri Apr 08 02:31:52 2022: argv[3]: <bazel>
Fri Apr 08 02:31:52 2022: argv[4]: <build>
Fri Apr 08 02:31:52 2022: argv[5]: <//security/security-hub/...>
Fri Apr 08 02:31:52 2022: argv[6]: <--config>
Fri Apr 08 02:31:52 2022: argv[7]: <linux64>
Fri Apr 08 02:31:52 2022: argv[8]: <--config>
Fri Apr 08 02:31:52 2022: argv[9]: <beta>
Fri Apr 08 02:31:52 2022: argv[10]: <--experimental_scale_timeouts=3.0>
Fri Apr 08 02:31:52 2022: skipping process with pid: 12962
Fri Apr 08 02:31:52 2022: process created with pid: 12968
Fri Apr 08 02:31:52 2022: parent pid: 12963
Fri Apr 08 02:31:52 2022: working directory: </home/ess/fold/security/security-hub>
Fri Apr 08 02:31:52 2022: executable: </home/ess/.cache/bazelisk/downloads/https---build-artifactory-eng-files-local-bazelbuild-cayman-bazel/bazel-4.0.0-linux-x86_64/bin/bazel>
Fri Apr 08 02:31:52 2022: argv[0]: </home/ess/.cache/bazelisk/downloads/https---build-artifactory-eng-files-local-bazelbuild-cayman-bazel/bazel-4.0.0-linux-x86_64/bin/bazel>
Fri Apr 08 02:31:52 2022: argv[1]: <build>
Fri Apr 08 02:31:52 2022: argv[2]: <//security/security-hub/...>
Fri Apr 08 02:31:52 2022: argv[3]: <--config>
Fri Apr 08 02:31:52 2022: argv[4]: <linux64>
Fri Apr 08 02:31:52 2022: argv[5]: <--config>
Fri Apr 08 02:31:52 2022: argv[6]: <beta>
Fri Apr 08 02:31:52 2022: argv[7]: <--experimental_scale_timeouts=3.0>
Fri Apr 08 02:31:52 2022: skipping process with pid: 12968
Fri Apr 08 02:32:01 2022: finalizing json file
Fri Apr 08 02:32:01 2022: returned with code: 0

Hey there.

Have you checked the documentation on Building with Bazel?

I had not noticed that section earlier, thanks for pointing it out!

  • On running
build-wrapper-linux-x86-64 --out-dir <build-wrapper-output-directory> bazel --batch build --spawn_strategy=local --strategy=Genrule=local --bazelrc=/dev/null <targets> <important-flags>

this is my output,

WARNING: Running Bazel server needs to be killed, because the startup options are different.
WARNING: ignoring LD_PRELOAD in environment.
ERROR: --bazelrc=/dev/null :: Unrecognized option: --bazelrc=/dev/null

Is my usage of the command correct?
Thanks

Following this post, I have learnt that

the docs on cfamily seem outdated(?)

as the --batch command is deprecated and Bazel complains when I use --spawn_strategy=local --genrule_strategy=local --bazelrc=/dev/null

Following the solution on the very post, I have run

bazel clean
build-wrapper-linux-x86-64 --out-dir <build-wrapper-output-directory> bazel --batch build --spawn_strategy=standalone --genrule_strategy=standalone <targets> <important-flags>
sonar-scanner

and my scan execution is successful!
Thank you

Thanks for the follow-up! Glad I at least got you in the right direction. I’ve pinged the relevant team to see if a docs update is neccessary.

1 Like

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