rust-lang / cc-rs

Rust library for build scripts to compile C/C++ code into a Rust library
https://docs.rs/cc
Apache License 2.0
1.87k stars 451 forks source link

Regression >= 1.1.32 unable to build on buildsystems which set tune buildflags, e.g. yocto #1296

Open mlilien opened 21 hours ago

mlilien commented 21 hours ago

With version 1.1.32 a build system which already sets tune buildflags can't build anymore. E.g. for a raspberry pi 3 in yocto, i get

|   cargo:warning=arm-omnect-linux-gnueabi-gcc: error: -mfloat-abi=soft and -mfloat-abi=hard may not be used together

I would prefer a feature or an option via envvar to prevent cc from guessing compile flags.

madsmtm commented 17 hours ago

That sounds like a custom target, which is very difficult for cc to support.

What is the expected value for -mfloat-abi?

mlilien commented 15 hours ago

Yes, it is a custom target which sets -mfloat-abi=hard. It clashes with https://github.com/rust-lang/cc-rs/blob/main/src/lib.rs#L2222-L2231. a way to prevent cc from setting additional flags, e.g. via env var would be nice. in my project cc is used by a dependency.