cc-rs: `clang` build fails with "invalid version 'softfloat'" on aarch64-unknown-none-softfloat target with cc crate 1.2.17

When building a Rust project that uses the cc crate (version 1.2.17) for the aarch64-unknown-none-softfloat target, the build fails if clang is used as the C compiler.

The error message from clang is:

clang: error: version 'softfloat' in target triple 'aarch64-unknown-none-softfloat' is invalid

The cc crate appears to be invoking clang with the full target triple --target=aarch64-unknown-none-softfloat. It seems that some versions of clang do not accept the softfloat version string within the target triple for this architecture.

Steps to Reproduce (based on our experience):

Use a build.rs script that utilizes the cc crate (version 1.2.17). Set the build target to aarch64-unknown-none-softfloat (either through environment variables like TARGET or by calling build.target() in the build script). Ensure clang is selected as the C compiler (e.g., env::set_var(“CC”, “clang”); in build.rs or via environment variable). Run cargo build --target aarch64-unknown-none-softfloat.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15

Most upvoted comments

I can fairly confidently confirm this isn’t an issue with cc-rs, I’ve just managed to compile with 1.2.17. The problem is likely something to do with interplay between older versions of the crates we use.