| Summary: | Rust cc crate mixes host flags with target flags | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Gyorgy Sarvari <skandigraun> | ||||
| Component: | devtools / tool chain | Assignee: | Deepesh Varatharajan <deepesh.varatharajan> | ||||
| Status: | NEW --- | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | Medium | CC: | ccasciato, meta.mr.watcher, meta.watcher, randy.macleod, ross.burton, sundeep.kokkonda | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 6.1 M2 | ||||||
| Hardware: | All | ||||||
| OS: | Multiple | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | Don't know | |||||
| Attachments: |
|
||||||
|
Description
Gyorgy Sarvari
2025-09-18 05:55:09 UTC
Certain environment variables are passed through to the bitbake system. We need more info on what happened here and then to decide if we can prevent it. Move to 6.0. Gyorgy, do you happen to have a simple reproducer or a suggestion about how we could produce one? Created attachment 5168 [details]
cc-rs-test.tar.gz
The easiest reproduction is to have a Cargo.toml that marks a crate as a build-only dependency - that crate will be compiled with wrong flags (when cross-compiling).
This happens with Firefox and Rust also. (But I gotta admit, both are pretty big for testing this).
I have attached a simple repro. This is a hello world, with a build-dependency that uses cc-rs - the dependency itself is irrelevant.
To see the problem, before compiling set two environment variables:
export HOST_CFLAGS=THIS_SHOULD_NOT_APPEAR_ALONG_WITH_CFLAGS
export CFLAGS=THIS_SHOULD_NOT_APPEAR_WHEN_COMPILING_RING
CC_ENABLE_DEBUG_OUTPUT=1 cargo build -vv
Of course both variables are bogus, but they shouldn't be used together in the same compilation command - and the error you will get will show however that they are used in the same compilation command, when compiling ring crate for the host.
|