rust-lang / stdarch

Rust's standard library vendor-specific APIs and run-time feature detection
https://doc.rust-lang.org/stable/core/arch/
Apache License 2.0
599 stars 260 forks source link

Build fails with stdarch_x86_has_cpuid featuer error #1526

Closed nikic closed 5 months ago

nikic commented 5 months ago

Trying to run cargo +nightly test in the root directory, I get:

   Compiling std_detect v0.1.5 (/home/npopov/repos/stdarch/crates/std_detect)
   Compiling serde_json v1.0.113
   Compiling csv v1.3.0
   Compiling serde-xml-rs v0.6.0
   Compiling env_logger v0.8.4
   Compiling env_logger v0.10.2
error[E0658]: use of unstable library feature 'stdarch_x86_has_cpuid'
  --> crates/std_detect/src/detect/os/x86.rs:33:9
   |
33 |     if !has_cpuid() {
   |         ^^^^^^^^^
   |
   = note: see issue #60123 <https://github.com/rust-lang/rust/issues/60123> for more information
   = help: add `#![feature(stdarch_x86_has_cpuid)]` to the crate attributes to enable
   = note: this compiler was built on 2024-02-13; consider upgrading it if it is out of date

error[E0635]: unknown feature `stdsimd`
  --> crates/std_detect/src/lib.rs:26:56
   |
26 | #![cfg_attr(not(feature = "rustc-dep-of-std"), feature(stdsimd))]
   |                                                        ^^^^^^^

Some errors have detailed explanations: E0635, E0658.
For more information about an error, try `rustc --explain E0635`.
error: could not compile `std_detect` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `std_detect` (lib test) due to 2 previous errors

I'm not sure whether something in nightly broke this crate or whether this crate requires a special incantation to build?

Amanieu commented 5 months ago

Should be fixed by #1523.

Amanieu commented 5 months ago

Though it seems we are now hitting a new error on i586-unknown-linux-gnu:

LLVM ERROR: Do not know how to split the result of this operator!

Was there an LLVM update recently?

nikic commented 5 months ago

Yes, https://github.com/rust-lang/rust/pull/120055 landed yesterday. I put up https://github.com/rust-lang/rust/pull/121088 to fix this issue.

nikic commented 5 months ago

This makes x86_64 pass tests, but on i586 we have ~4000 test failures of the kind:

---- core_arch::x86::tbm::assert__blcfill_u32_blcfill stdout ----
disassembly for stdarch_test_shim__blcfill_u32_blcfill: 
     0: call 19ddf5 <stdarch_test_shim__blcfill_u32_blcfill+0x5>
     1: pop %eax
     2: add $0x51df6b,%eax
     3: mov 0x4(%esp),%ecx
     4: lea -0x28a16a(%eax),%edx
     5: mov 0x224(%eax),%eax
     6: mov %edx,(%eax)
     7: blcfill %ecx,%eax
     8: ret
     9: xchg %ax,%ax
    10: xchg %ax,%ax
    11: xchg %ax,%ax
    12: xchg %ax,%ax
    13: xchg %ax,%ax
    14: xchg %ax,%ax
thread 'core_arch::x86::tbm::assert__blcfill_u32_blcfill' panicked at crates/stdarch-test/src/lib.rs:184:9:
instruction found, but the disassembly contains subroutine call instructions, which hint that inlining failed
nikic commented 5 months ago

Nevermind that last comment, apparently that's normal without -C relocation-model=static.