waf: detect 64-bit Linux targets for DroneCAN#33752
Open
dlanov wants to merge 1 commit into
Open
Conversation
Signed-off-by: Dennis Lanov <dennis.lanov@gmail.com>
khancyr
reviewed
Jul 21, 2026
khancyr
left a comment
Contributor
There was a problem hiding this comment.
I would say OK
But we need to look at the combination of this that auto set 64bit flag and the --force-32bit . We may have some conflict there.
khancyr
approved these changes
Jul 21, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Detect the configured Linux target's pointer width and define
CANARD_64_BITexplicitly for 64-bit DroneCAN builds.Fixes #33721.
Classification & Testing
Description
Libcanard determines whether it is compiling for a 64-bit target using glibc's
__WORDSIZEmacro. Musl does not provide that macro through the headers included by libcanard, so an AArch64 musl build incorrectly selects the 32-bit libcanard data layout and fails its compile-time structure-layout assertion.Add a compile-only Waf check that uses the configured target C compiler to determine whether pointers are eight bytes. When the check succeeds,
CANARD_64_BIT=1is added to the common build definitions, including the generated DroneCAN C sources.The check is limited to Linux boards with CAN enabled and does not rely on the build host architecture or an architecture-name list.
Testing
AArch64 Alpine/musl baseline
Before the change, the static Linux Rover build failed in generated DroneCAN C sources with:
AArch64 Alpine/musl after the change
Checking for 64-bit pointers: yesCANARD_64_BIT=1ARMHF/musl regression build
Using the existing
navigatorARMHF/musl CI-style build:Checking for 64-bit pointers: noCANARD_64_BIT=1was absent fromcompile_commands.jsonAdditional checks:
git diff --checkpython3 -m py_compile Tools/ardupilotwaf/boards.pyTools/scripts/check_branch_conventions.pyTools/ardupilotwaf/boards.pychangedAI Assistance
This contribution was AI-assisted. Claude and ChatGPT were used to analyze the Waf and libcanard behavior, develop the validation plan, and review the proposed change and test results. I reproduced the failure, reviewed the code, ran the listed builds and checks, and take responsibility for the submitted change.