Bug 16018 - cargo.bbclass should mandate out-of-tree builds
Summary: cargo.bbclass should mandate out-of-tree builds
Status: NEW
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 5.2
Hardware: x86 Multiple
: Medium normal
Target Milestone: 6.1
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-10-17 10:14 UTC by Ross Burton
Modified: 2026-05-21 15:27 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Yes (doc changes required)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2025-10-17 10:14:43 UTC
Currently cargo.bbclass does out-of-tree builds but supports in-tree builds.  But cargo has out-of-tree as a first class citizen and three independent people said that if it doesn't work you've found a bug in a package.

So we should mandate S!=B and just always cleandirs B. This will remove some logic from the cargo class.

Complication: as rust is often conjoined with other projects, we should set B=WORKDIR/build but then tell cargo to use B/target and cleandirs B/target.
Comment 1 Ross Burton 2026-05-21 15:27:44 UTC
The catch here is that cargo-common can't do this as it gets reused in recipes that do rust-and-something-else, like librsvg/maturin.