Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: Cannot specify string config options in cli #86151

Closed
m-torhan opened this issue Feb 21, 2025 · 2 comments
Closed

cmake: Cannot specify string config options in cli #86151

m-torhan opened this issue Feb 21, 2025 · 2 comments
Assignees
Labels
area: Build System bug The issue is a bug, or the PR is fixing a bug

Comments

@m-torhan
Copy link

m-torhan commented Feb 21, 2025

Describe the bug
When trying to build app with string config option specified in cli like:

west build -p always -b stm32f746g_disco ./samples/basic/blinky -- -DCONFIG_USB_DEVICE_PRODUCT=\"test\"

or

west build -p always -b stm32f746g_disco ./samples/basic/blinky -- '-DCONFIG_USB_DEVICE_PRODUCT="test"'

the build fails with

CMake Error at /.../zephyr/cmake/modules/yaml.cmake:551 (string):
  string sub-command JSON failed parsing json string: * Line 65, Column 116

    Missing ',' or '}' in object declaration

  .
Call Stack (most recent call first):
  /.../zephyr/cmake/modules/yaml.cmake:494 (to_yaml)
  /.../zephyr/CMakeLists.txt:2307 (yaml_save)

To Reproduce

  1. Clone Zephyr repository, run west init and update.
  2. Run build (as above)
west build -p always -b stm32f746g_disco ./samples/basic/blinky -- -DCONFIG_USB_DEVICE_PRODUCT=\"test\"

Expected behavior
App is built with no errors.

Impact
Cannot specify string config options in cli.

Environment (please complete the following information):

  • OS: Linux (6.13.2-arch1-1)
  • Toolchain: zephyr 0.16.5
  • Commit: ad845fd

Additional context
As it worked before, I checked which commit introduced this issue and found this:
cdbe424
which makes sense as \" in the JSON are turned into \\". Part of this JSON

  "west" : 
  {
    "command" : "/.../zephyr/.venv/bin/west build -p always -b stm32f746g_disco ./samples/basic/blinky -- -DCONFIG_USB_DEVICE_PRODUCT=\"test\"",
    "topdir" : "/.../",
    "version" : "1.3.0"
  }

After ESCAPE macro:

  "west" : 
  {
    "command" : "/.../zephyr/.venv/bin/west build -p always -b stm32f746g_disco ./samples/basic/blinky -- -DCONFIG_USB_DEVICE_PRODUCT=\\"test\\"",
    "topdir" : "/.../",
    "version" : "1.3.0"
  }
@m-torhan m-torhan added the bug The issue is a bug, or the PR is fixing a bug label Feb 21, 2025
Copy link

Hi @m-torhan! 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. 🤖💙

@kartben
Copy link
Collaborator

kartben commented Feb 22, 2025

@m-torhan thanks for taking the time to report this!
Closing as duplicate of #86167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

4 participants