compiler-explorer / compiler-explorer

Run compilers interactively from your web browser and interact with the assembly
https://godbolt.org/
BSD 2-Clause "Simplified" License
16.38k stars 1.74k forks source link

[BUG]: Using mips targets with rust nightly results in error about corrupt metadata #6831

Open bjorn3 opened 1 month ago

bjorn3 commented 1 month ago

Describe the bug

See title

This may be related to the fact that MIPS has been by rustc demoted to tier 3 a while back. In other words no pre-compiled standard library is shipped anymore. If the nightly container gets updated every time rather than built from scratch it is possible that old artifacts for MIPS are remaining in the sysroot of rustc.

Steps to reproduce

  1. Select rust as language
  2. Write some random code. Eg an empty comment: //
  3. Select nightly rustc
  4. Pass --target mips64-unknown-linux-gnuabi64 or --target mips-unknown-linux-gnu as argument
  5. The following error is shown:
error[E0786]: found invalid metadata files for crate `std`
  |
  = note: corrupt metadata encountered in /opt/compiler-explorer/rust-nightly/lib/rustlib/mips64-unknown-linux-gnuabi64/lib/libstd-03e2253ad8f4d122.rlib
  = note: invalid metadata version found: /opt/compiler-explorer/rust-nightly/lib/rustlib/mips64-unknown-linux-gnuabi64/lib/libstd-03e2253ad8f4d122.so
  = note: corrupt metadata encountered in /opt/compiler-explorer/rust-nightly/lib/rustlib/mips64-unknown-linux-gnuabi64/lib/libstd_detect-af725589d663112b.rlib

Expected behavior

It either complains about can't find crate for `std` or compiles successfully.

Reproduction link

https://rust.godbolt.org/z/a7aTjx83v

Screenshots

Not applicable

Operating System

Not relevant

Browser version

Not relevant

dkm commented 1 month ago

Hey @bjorn3 ! Our install is really swapping old and new installation, so we should not have any issue of installing new files over old incompatible files... But it seems rust is still providing old mips std: https://static.rust-lang.org/dist/rust-std-nightly-mips-unknown-linux-gnu.tar.gz and our scripts simply fetch the compiler and the libstd.

Maybe the archive should be removed from rust-lang? I guess there's no reason for keeping nightly tarballs if the corresponding nightly compiler is incompatible. Then, we'll probably need to adjust our scripts. I'm not sure yet if they can handle tier 3 target.

bjorn3 commented 1 month ago

Each nightly release has a separate subdirectory with all components for that release. The root has the latest version of the component for the given channel. Maybe using the subdirectory for the nightly would be better Or alternatively actually parsing the manifest file to determine which components are available?

dkm commented 1 month ago

Ha, makes sense. I'll see what I can do, thanks for the details (as always ;))