zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.96k stars 6.67k forks source link

CODECHECKER_ANALYZE_OPTS not passed through to codechecker when using sysbuild #79362

Closed xcoponet closed 1 month ago

xcoponet commented 1 month ago

Describe the bug When using Codechecker as an SCA tool with sysbuild, options like CODECHECKER_ANALYZE_OPTS are not passed through to the tool.

To Reproduce

  1. west build -b nrf5340dk/nrf5340/cpuapp <app> --no-sysbuild -- -DZEPHYR_SCA_VARIANT=codechecker -DCODECHECKER_ANALYZE_OPTS="--ignore;/path/to/codechecker-skip.txt"
  2. In the logs, we get "cd /home/xavier/alk/build && /home/xavier/.local/bin/CodeChecker analyze --keep-gcc-include-fixed --keep-gcc-intrin --output /home/xavier/alk/build/sca/codechecker/codechecker.plist --name zephyr --ignore /home/xavier/alk/boa/codechecker_skip.txt /home/xavier/alk/build/compile_commands.json || /usr/bin/cmake -E true"
  3. west build -b nrf5340dk/nrf5340/cpuapp <app> --sysbuild -- -DZEPHYR_SCA_VARIANT=codechecker -DCODECHECKER_ANALYZE_OPTS="--ignore;/path/to/codechecker-skip.txt"
  4. In the logs, we get "cd /home/xavier/alk/build_sysbuild/boa && /home/xavier/.local/bin/CodeChecker analyze --keep-gcc-include-fixed --keep-gcc-intrin --output /home/xavier/alk/build_sysbuild/boa/sca/codechecker/codechecker.plist --name zephyr /home/xavier/alk/build_sysbuild/boa/compile_commands.json || /usr/bin/cmake -E true". As we can see, no mention of the ignore option
  5. When adding message("CODECHECKER_ANALYZE_OPTS ${CODECHECKER_ANALYZE_OPTS}") in zephyr/cmake/sca/codechecker/sca.cmake, we get that CODECHECKER_ANALYZE_OPTS is empty.

Expected behavior Sysbuild should pass command line options through to zephyr/cmake/sca/codechecker/sca.cmake

Environment (please complete the following information):

github-actions[bot] commented 1 month ago

Hi @xcoponet! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

pdgendt commented 1 month ago

A work-around for this, is to set it in the environment instead:

$ CODECHECKER_ANALYZE_OPTS="--ignore;/path/to/codechecker-skip.txt" west build -b nrf5340dk/nrf5340/cpuapp <app> --sysbuild -- -DZEPHYR_SCA_VARIANT=codechecker

EDIT: this might not work for 3.6 though

xcoponet commented 1 month ago

Indeed, it doesn't work on version 3.6. I'm dependent on the version shipped with the nRF SDK. I will continue building without sysbuild until Nordic updates to 3.7.