Skip to content

error: unable to run rust-objcopy: Bad CPU type in executable (os error 86) #145699

Closed

Description

@Wyvern

Host: x86_64-apple-darwin
rustc 1.91.0-nightly (040a98af7 2025-08-20)

Compile with error:
error: unable to run rust-objcopy: Bad CPU type in executable (os error 86)

full output:

error: unable to run `rust-objcopy`: Bad CPU type in executable (os error 86)

error: could not compile `proc-macro2` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `libc` (build script) due to 1 previous error

Activity

  1. added
    needs-triage
    on Aug 21, 2025
  2. Wyvern commented on Aug 21, 2025

    @Wyvern
    Author

    on x86_64-apple-darwin host run:

    > file .rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy
    rust-objcopy: Mach-O 64-bit executable arm64
    

    looks like rust-objcopy compiled to tier1 arm64 apple target rather than host x86_64.

    The problem maybe related to demote x86_64-apple-darwin to tier2.

  3. added
    O-x86_64
    T-bootstrap
    C-bug
    O-apple
    on Aug 21, 2025
  4. Gelbpunkt commented on Aug 21, 2025

    @Gelbpunkt
    Contributor

    This is a problem on all tier 2 targets. The rust-objcopy executable is linked and compiled for the host that compiled it rather than the target. See also #143415 (comment)

  5. Wyvern commented on Aug 21, 2025

    @Wyvern
    Author

    interesting, only objcopy got a wrong target compiling.

    > file .rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/*
    rust-lld:          Mach-O 64-bit executable x86_64
    rust-objcopy:      Mach-O 64-bit executable arm64
    wasm-component-ld: Mach-O 64-bit executable x86_64
    
  6. benalleng commented on Aug 21, 2025

    @benalleng

    I can confirm I see the same problem only with rust-objcopy.

    file $HOME/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/*
    /Users/runner/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-lld:          Mach-O 64-bit executable x86_64
    /Users/runner/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy:      Mach-O 64-bit executable arm64
    /Users/runner/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/wasm-component-ld: Mach-O 64-bit executable x86_64
    
  7. lqd commented on Aug 21, 2025

    @lqd
    Member

    Could anyone bisect this issue with https://github.com/rust-lang/cargo-bisect-rustc/?

    I'll also cc @shepmaster in case it's related to demoting the target, but without the bisection it could be any other CI change on the builder or a bootstrap issue, so I'll also cc @Kobzol.

    BTW, a possible temporary workaround would be setting strip = false in your Cargo.toml, that should remove the need to run rust-objcopy in the first place.

  8. shepmaster commented on Aug 22, 2025

    @shepmaster
    Member

    bisect this issue

    If you bisect this specific issue of rust-objcopy being aarch64 instead of x86_64, I'd expect it to come back to the demotion PR. However, if this is occurring for any cross-compilation (as mentioned above), then you'd have to bisect any (every?) cross-compiled toolchain for a rust-objcopy binary being the wrong architecture.

    For example, this shows rustc-objcopy is x86_64 when it should be aarch64 for the aarch64-unknown-linux-musl target:

    cd $HOME/.rustup/toolchains/nightly-aarch64-unknown-linux-musl/lib/rustlib/*/bin ; file *
    
    gcc-ld:            directory
    rust-lld:          ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, with debug_info, not stripped
    rust-objcopy:      ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=486eb10c870e12cbb52f742c3322a19cc027b776, for GNU/Linux 3.2.0, not stripped
    wasm-component-ld: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, stripped
    
  9. thaliaarchi commented on Aug 22, 2025

    @thaliaarchi
    Contributor

    The regression appears to have happened yesterday:

    $ file "$(find ~/.rustup -name rust-objcopy)"
    ~/.rustup/toolchains/1.85-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy:               Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/1.86-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy:               Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy:             Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/beta-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy:               Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/nightly-2025-02-15-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy: Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/nightly-2025-03-20-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy: Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/nightly-2025-03-30-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy: Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/nightly-2025-04-22-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy: Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/nightly-2025-08-20-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy: Mach-O 64-bit executable x86_64
    ~/.rustup/toolchains/nightly-2025-08-21-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/rust-objcopy: Mach-O 64-bit executable arm64
    
  10. shepmaster commented on Aug 22, 2025

    @shepmaster
    Member

    The regression appears to have happened yesterday

    Yes, as stated above, this will look like it occurred due to the Tier 2 demotion in the last few days, but the root problem predates this as it affects cross compiled builds in general.

  11. added a commit that references this issue on Aug 23, 2025
  12. removed
    needs-triage
    on Aug 23, 2025
  13. added a commit that references this issue on Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugO-appleO-x86_64T-bootstrap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions