Bug 16018

Summary: cargo.bbclass should mandate out-of-tree builds
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: devtools / tool chainAssignee: Ross Burton <ross.burton>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher, tim.orling, yoann.congal
Version: 5.2   
Target Milestone: 6.1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

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.