rust-lang / rust-lang/rust

Invalid metadata for arm64e due to Xcode 15+ on ARM64e macOS

Open
#130,834 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-Arm O-macos regression-untriaged T-bootstrap T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried to compile arm64e-apple-darwin on aarch64 (ARM-based CPU) macOS. So, I got the following error

error[E0786]: found invalid metadata files for crate `zerocopy_derive`


  error[E0786]: found invalid metadata files for crate `zerocopy_derive`
     --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/lib.rs:285:9
      |
  285 | pub use zerocopy_derive::Unaligned;
      |         ^^^^^^^^^^^^^^^
      |
      = note: no `.rustc` section in '/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/deps/libzerocopy_derive-85cad85f9873b5cd.dylib'
  
  error[E0786]: found invalid metadata files for crate `zerocopy_derive`
     --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/lib.rs:293:9
      |
  293 | pub use zerocopy_derive::KnownLayout;
      |         ^^^^^^^^^^^^^^^
      |
      = note: no `.rustc` section in '/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/deps/libzerocopy_derive-85cad85f9873b5cd.dylib'
  
  error[E0786]: found invalid metadata files for crate `zerocopy_derive`
      --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/lib.rs:1118:9
       |
  1118 | pub use zerocopy_derive::FromZeroes;
       |         ^^^^^^^^^^^^^^^
       |
       = note: no `.rustc` section in '/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/deps/libzerocopy_derive-85cad85f9873b5cd.dylib'
  
  error[E0786]: found invalid metadata files for crate `zerocopy_derive`
      --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/lib.rs:1733:9
       |
  1733 | pub use zerocopy_derive::FromBytes;
       |         ^^^^^^^^^^^^^^^
       |
       = note: no `.rustc` section in '/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/deps/libzerocopy_derive-85cad85f9873b5cd.dylib'
  
  error[E0786]: found invalid metadata files for crate `zerocopy_derive`
      --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/lib.rs:2599:9
       |
  2599 | pub use zerocopy_derive::AsBytes;
       |         ^^^^^^^^^^^^^^^
       |
       = note: no `.rustc` section in '/Users/runner/work/rust-compiler-builder/rust-compiler-builder/rust/build/aarch64-apple-darwin/stage1-rustc/arm64e-apple-darwin/release/deps/libzerocopy_derive-85cad85f9873b5cd.dylib'
  
  error[E0432]: unresolved import `crate::KnownLayout`
    --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/util.rs:21:34
     |
  21 |     use crate::{util::AsAddress, KnownLayout, _CastType};
     |                                  ^^^^^^^^^^^
  
  [RUSTC-TIMING] displaydoc test:false 7.021
     Compiling tracing-attributes v0.1.27
  error[E0277]: the trait bound `byteorder::U16<O>: FromZeroes` is not satisfied
     --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/byteorder.rs:292:49
      |
  236 | / macro_rules! define_type {
  237 | |     ($article:ident,
  238 | |         $name:ident,
  239 | |         $native:ident,
  ...   |
  292 | |             impl_or_verify!(O => FromZeroes for $name<O>);
      | |                                                 ^^^^^^^^ the trait `FromZeroes` is not implemented for `byteorder::U16<O>`
  ...   |
  462 | |     };
  463 | | }
      | |_- in this expansion of `define_type!`
  464 |
  465 | / define_type!(
  466 | |     A,
  467 | |     U16,
  468 | |     u16,
  ...   |
  477 | |     [U32, U64, U128]
  478 | | );
      | |_- in this macro invocation
      |
      = help: the following other types implement trait `FromZeroes`:
                ()
                *const T
                *mut T
                ManuallyDrop<T>
                MaybeUninit<T>
                Option<&T>
                Option<&mut T>
                Option<NonNull<T>>
              and 103 others
  note: required by a bound in `byteorder::_::_::Subtrait`
     --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/macros.rs:323:29
      |
  28  | / macro_rules! safety_comment {
  29  | |     (#[doc = r" SAFETY:"] $($(#[$attr:meta])* $macro:ident!$args:tt;)*) => {
  30  | |         #[allow(clippy::undocumented_unsafe_blocks, unused_attributes)]
  31  | |         const _: () = { $($(#[$attr])* $macro!$args;)* };
      | |                                        ------------ in this macro invocation (#3)
  32  | |     }
  33  | | }
      | |_- in this expansion of `safety_comment!` (#2)
  ...
  279 | / macro_rules! impl_or_verify {
  280 | |     // The following two match arms follow the same pattern as their
  281 | |     // counterparts in `unsafe_impl!`; see the documentation on those arms for
  282 | |     // more details.
  ...   |
  302 | /         impl_or_verify!(@verify $trait, {
  303 |               impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {}
  304 | |         });
      | |__________- in this macro invocation (#4)
  ...
  323 | |             trait Subtrait: $trait {}
      | |                             ^^^^^^ required by this bound in `Subtrait`
  ...   |
  326 | |     };
  327 | | }
      | | -
      | |_|
      | |_in this expansion of `impl_or_verify!` (#3)
      |   in this expansion of `impl_or_verify!` (#4)
      |
     ::: /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/byteorder.rs:236:1
      |
  236 | / macro_rules! define_type {
  237 | |     ($article:ident,
  238 | |         $name:ident,
  239 | |         $native:ident,
  ...   |
  287 | /         safety_comment! {
  288 |               /// SAFETY:
  289 |               /// `$name<O>` is `repr(transparent)`, and so it has the same layout
  290 |               /// as its only non-zero field, which is a `u8` array. `u8` arrays
  ...
  295 |               impl_or_verify!(O => Unaligned for $name<O>);
  296 | |         }
      | |_________- in this macro invocation (#2)
  ...
  462 | |     };
  463 | | }
      | |_- in this expansion of `define_type!` (#1)
  464 |
  465 | / define_type!(
  466 | |     A,
  467 | |     U16,
  468 | |     u16,
  ...   |
  477 | |     [U32, U64, U128]
  478 | | );
      | |_- in this macro invocation (#1)
  
  error[E0277]: the trait bound `byteorder::U16<O>: FromBytes` is not satisfied
     --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/byteorder.rs:293:48
      |
  236 | / macro_rules! define_type {
  237 | |     ($article:ident,
  238 | |         $name:ident,
  239 | |         $native:ident,
  ...   |
  293 | |             impl_or_verify!(O => FromBytes for $name<O>);
      | |                                                ^^^^^^^^ the trait `FromBytes` is not implemented for `byteorder::U16<O>`
  ...   |
  462 | |     };
  463 | | }
      | |_- in this expansion of `define_type!`
  464 |
  465 | / define_type!(
  466 | |     A,
  467 | |     U16,
  468 | |     u16,
  ...   |
  477 | |     [U32, U64, U128]
  478 | | );
      | |_- in this macro invocation
      |
      = help: the following other types implement trait `FromBytes`:
                ()
                ManuallyDrop<T>
                MaybeUninit<T>
                Option<NonZero<i128>>
                Option<NonZero<i16>>
                Option<NonZero<i32>>
                Option<NonZero<i64>>
                Option<NonZero<i8>>
              and 69 others
  note: required by a bound in `byteorder::_::_::Subtrait`
     --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/macros.rs:323:29
      |
  28  | / macro_rules! safety_comment {
  29  | |     (#[doc = r" SAFETY:"] $($(#[$attr:meta])* $macro:ident!$args:tt;)*) => {
  30  | |         #[allow(clippy::undocumented_unsafe_blocks, unused_attributes)]
  31  | |         const _: () = { $($(#[$attr])* $macro!$args;)* };
      | |                                        ------------ in this macro invocation (#3)
  32  | |     }
  33  | | }
      | |_- in this expansion of `safety_comment!` (#2)
  ...
  279 | / macro_rules! impl_or_verify {
  280 | |     // The following two match arms follow the same pattern as their
  281 | |     // counterparts in `unsafe_impl!`; see the documentation on those arms for
  282 | |     // more details.
  ...   |
  302 | /         impl_or_verify!(@verify $trait, {
  303 |               impl<$($tyvar $(: $(? $optbound +)* $($bound +)*)?),*> Subtrait for $ty {}
  304 | |         });
      | |__________- in this macro invocation (#4)
  ...
  323 | |             trait Subtrait: $trait {}
      | |                             ^^^^^^ required by this bound in `Subtrait`
  ...   |
  326 | |     };
  327 | | }
      | | -
      | |_|
      | |_in this expansion of `impl_or_verify!` (#3)
      |   in this expansion of `impl_or_verify!` (#4)
      |
     ::: /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/byteorder.rs:236:1
      |
  236 | / macro_rules! define_type {
  237 | |     ($article:ident,
  238 | |         $name:ident,
  239 | |         $native:ident,
  ...   |
  287 | /         safety_comment! {
  288 |               /// SAFETY:
  289 |               /// `$name<O>` is `repr(transparent)`, and so it has the same layout
  290 |               /// as its only non-zero field, which is a `u8` array. `u8` arrays
  ...
  295 |               impl_or_verify!(O => Unaligned for $name<O>);
  296 | |         }
      | |_________- in this macro invocation (#2)
  ...
  462 | |     };
  463 | | }
      | |_- in this expansion of `define_type!` (#1)
  464 |
  465 | / define_type!(
  466 | |     A,
  467 | |     U16,
  468 | |     u16,
  ...   |
  477 | |     [U32, U64, U128]
  478 | | );
      | |_- in this macro invocation (#1)
  
  error[E0277]: the trait bound `byteorder::U16<O>: AsBytes` is not satisfied
     --> /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zerocopy-0.7.35/src/byteorder.rs:294:46
      |
  236 | / macro_rules! define_type {
  237 | |     ($article:ident,
  238 | |         $name:ident,
  239 | |         $native:ident,
  ...   |
  294 | |             impl_or_verify!(O => AsBytes for $name<O>);
      | |                                              ^^^^^^^^ the trait `AsBytes` is not implemented for `byteorder::U16<O>`
  ...   |
  462 | |     };
  463 | | }
      | |_- in this expansion of `define_type!`
  464 |
  465 | / define_type!(
  466 | |     A,
  467 | |     U16,
  468 | |     u16,
  ...   |
  477 | |     [U32, U64, U128]
  478 | | );
      | |_- in this macro invocation
      |

This issue can be reproduced only on aarch64 (ARM-based CPU) macOS.

See https://github.com/google/zerocopy/issues/1739
See https://github.com/llvm/llvm-project/issues/79543

Blocked by https://github.com/llvm/llvm-project/issues/80200
Relates to https://github.com/rust-lang/rust/issues/130085

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported arm64e-apple-darwin compilation failure on aarch64 macOS, then read the linked zerocopy and LLVM issues, especially the blocker at LLVM issue 80200. The report names no Rust repository file or test entry point; done means the target builds without the invalid metadata errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, rust
Domain
compilers, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.