docs.rs icon indicating copy to clipboard operation
docs.rs copied to clipboard

error: RUSTFLAGS='-Ctarget-cpu=haswell' or later is required

Open pcarbonn opened this issue 11 months ago • 2 comments

Crate name

m2csmt-0.1.2

Build failure link

https://docs.rs/crate/m2csmt/0.1.2/builds/1579956/x86_64-unknown-linux-gnu.txt

Additional details

My crate has the inari crate as a dependency. Inari requires an haswell CPU, and docs.rs raises the error above during the build. I configured .cargo/config.toml accordingly, but docs.rs seems to ignore it.

What can I do ?

pcarbonn avatar Dec 09 '24 13:12 pcarbonn

I don't have much time to dig into how your package and inari interact, but here some points where you can start looking:

For these kind of errors it's always good to look into how the dependency itself builds the docs, it the build is successful. Specifically, you can look at the docs.rs metadata in the cargo.toml file and what features are activated for docs.

On top of that, there might be conditional compilation with #[cfg(docsrs)]. The interesting part is that the error you are seeing is actually inactive for docs: https://github.com/unageek/inari/blob/9e519ce47c9baa897bf11a735300ca4718a7a2a1/src/simd.rs

syphar avatar Dec 10 '24 05:12 syphar

Thank you for your reply.

I still cannot make it work. I won't spend more time on this issue. One can use my m2csmt package after adding these lines to their .cargo/config.toml, and that seems OK to me for now:

[build]
rustflags = ["-C", "target-cpu=haswell"]
rustdocflags = ["-C", "target-cpu=haswell"]

pcarbonn avatar Dec 10 '24 15:12 pcarbonn

from what I see, this is either #1957 or #93

syphar avatar May 24 '25 15:05 syphar