fix(build): flexible binder header path for Yocto/sysroot (#644) - #670
Merged
Conversation
The component CMakeLists resolved binder headers only under a fixed 'include/binder_sdk' subdir, so Yocto/cross builds (headers staged flat under <sysroot>/usr/include) failed. Replace the rigid 2-candidate check with a candidate list that also accepts BINDER_SDK_INCLUDE_DIR as a direct include dir; the local-dev subdir layout is tried first, so existing builds are unaffected. Applied across all component current/ templates AND the committed <version>/ snapshots (build config only — the .hash covers the AIDL contract, not the CMakeLists; precedent: #629). 52 CMakeLists.txt updated. Verified: local-dev subdir + Yocto flat both resolve; missing headers still FATAL; a real 'build_modules.sh common' still builds. Sibling of #635.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates per-module CMake build logic to resolve Binder header include roots flexibly across local development layouts and Yocto/sysroot layouts, addressing Yocto build failures reported in #644 without regressing local builds.
Changes:
- Replaced the fixed
include/binder_sdkinclude-root assumption with a “first existing candidate wins” search across multiple possible header layouts. - Applied the updated Binder include-root resolution across both
current/module templates and versioned snapshotCMakeLists.txtfiles.
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| indicator/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| indicator/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| hdmiinput/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| hdmiinput/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| avclock/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| avclock/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| avclock/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| common/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| common/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| common/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| hdmicec/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| hdmicec/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| videosink/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| videosink/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| videosink/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiosink/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiosink/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiosink/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| firmwareupdate/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| firmwareupdate/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| deepsleep/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| deepsleep/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| sensor/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| sensor/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| sensor/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| hdmioutput/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| hdmioutput/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiodecoder/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiodecoder/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiodecoder/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| panel/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| panel/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| bootreason/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| bootreason/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| drm/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| drm/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| videodecoder/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| videodecoder/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| videodecoder/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiomixer/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiomixer/0.1.0.1/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiomixer/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| audiomixer/0.3.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| compositeinput/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| compositeinput/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| planecontrol/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| planecontrol/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| avbuffer/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| avbuffer/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| avbuffer/0.2.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| deviceinfo/current/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
| deviceinfo/0.1.0.0/CMakeLists.txt | Binder include-root resolution updated to support Yocto/sysroot layouts |
Tasks 1-4 stage headers under include/binder_sdk (dev subdir). Add Task 5: a flat Yocto-style sysroot (headers directly under <sysroot>/usr/include) and a configure-only check that a component (common) resolves them via BINDER_SDK_INCLUDE_DIR as a direct include dir. Absence of the 'Binder SDK headers not found' FATAL == resolved. Verified: passes with the #644 fix; FATALs against develop's old component CMake — so it regression-tests the flexible-include fix.
…review)
Copilot review: the candidate list could pick an unintended include root —
when BINDER_SDK_INCLUDE_DIR is unset, "${BINDER_SDK_INCLUDE_DIR}/include/binder_sdk"
expands to an absolute "/include/binder_sdk" that might match a host path; and
"${BINDER_SDK_DIR}/include/binder" is not a valid include root for <binder/...>.
Now each candidate is only added when its base variable is set (via list(APPEND)
guarded by if(BINDER_SDK_DIR)/if(BINDER_SDK_INCLUDE_DIR)), and the bogus
.../include/binder candidate is corrected to .../include (the actual root under
which binder/ lives). Priority order preserved. Applied across all 52 component
CMakeLists (templates + snapshots).
Copilot review: the bare ${BINDER_SDK_INCLUDE_DIR} candidate could match the
Yocto staging *prefix* (e.g. /usr) — which exists but is not a valid include
root — and the fake-yocto test passed BINDER_SDK_INCLUDE_DIR as a direct
include dir, not the prefix the README documents.
Unify on 'BINDER_SDK_INCLUDE_DIR = staging prefix': replace the bare candidate
with ${BINDER_SDK_INCLUDE_DIR}/include across all 52 component CMakeLists, so
both the namespaced (prefix/include/binder_sdk) and real-Yocto flat
(prefix/include, binder/ directly) layouts resolve. Fix the fake-yocto Task 5
to pass the prefix (mirroring the README). Verified: fake-yocto passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #644. Sibling of #635 (both Yocto CMake portability; different root cause).
Problem
Each component's
CMakeLists.txtresolved binder headers only under a fixedinclude/binder_sdksubdir:Yocto/cross builds stage headers flat (
<sysroot>/usr/include/...), so they hit the FATAL. The reporter's proposed fix (treatBINDER_SDK_INCLUDE_DIRas a direct path) would have broken local dev (which needs the subdir).Fix
A candidate list — first existing dir wins, dev layout tried first (no regression):
Applied across 52
CMakeLists.txt— all componentcurrent/templates and the committed<version>/snapshots. Snapshots are build-config only (the.hashcovers the AIDL contract, notCMakeLists.txt; precedent: #629), so this doesn't touch any frozen contract.Verified
./build_modules.sh commonstill builds (libcommon-vcurrent-cpp.so).