A recent update in the cc crate has changed the way C/C++ compiler flags are gathered, it now reads more environment variables than it used to: https://github.com/rust-lang/cc-rs/pull/1401 This now sometimes leads to incorrect results. I have noticed this during a recent Firefox update, which also brought the update of the cc crate: in case the recipe is compiled for the target, but a crate has a build-only dependency on another crate, then the used compiler flags look wrong. Build-only dependencies are compiled for the build-host (which is correct), but the crate reads both the CFLAGS/CXXFLAGS and HOST_CFLAGS/HOST_CXXFLAGS variables (the latter ones are defined by cargo_common.bbclass). However the former variables contain flags for the target, and the latter flags contain flags for the build host - and after mixing them, the result can be surprising. Upstream has a bug tracking this also: https://github.com/rust-lang/cc-rs/issues/1469
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.