Re: [PATCH v2 1/2] crosvm: add recipe for ChromeOS Virtual Machine Monitor (VMM)

Keerthivasan Raghavan <[email protected]> Tue, 23 Jun 2026 10:23:45 +0000
Newsgroups org.yoctoproject.lists.meta-virtualization
Message-ID <CH8PR02MB109712F19227670A82BC626ECF3EE2@CH8PR02MB10971.namprd02.prod.outlook.com>
Hi Bruce,

Thank you for the guidance and suggestions.

I reviewed another recipe that uses bindgen for creating sys crates:
https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-support/thin-provisioning-tools/thin-provisioning-tools_1.3.1.bb

I would like to propose using:

export BINDGEN_EXTRA_CLANG_ARGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}"

instead of:

export BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${STAGING_DIR_HOST}"

Rationale:

- HOST_CC_ARCH: Specifies architecture-specific compiler flags passed to the C compiler.
  Reference: https://docs.yoctoproject.org/ref-manual/variables.html#term-HOST_CC_ARCH

- TOOLCHAIN_OPTIONS: Holds additional options passed to the compiler and linker. For non-native recipes, these point to the custom sysroot via RECIPE_SYSROOT.
  Reference: https://docs.yoctoproject.org/ref-manual/variables.html#term-TOOLCHAIN_OPTIONS

- TARGET_SYS: Specifies the target system (architecture and operating system) for which the build is being performed.
  Reference: https://docs.yoctoproject.org/ref-manual/variables.html#term-TARGET_SYS

Given their intended purposes, using these variables makes the toolchain and target configuration more explicit. This helps prevent accidental "noise" or "crosstalk" with build host directories.

With this approach, bindgen (via libclang/clang frontend) will resolve system headers using the correct toolchain configuration, including all relevant compiler and target options. This should ensure consistent and correct header resolution, especially when extending the recipe class for native builds.

Overall, this feels more robust than specifying only the sysroot location.

Thank you,
Keerthivasan Raghavan