Skip to content

rust-objcopy is x86-64 executable on aarch64-unknown-linux-gnu #138943

Closed

Description

@Stevenjin8

If I download https://static.rust-lang.org/dist/rust-1.85.1-aarch64-unknown-linux-gnu.tar.xz (link from https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers), all the files are ARM executables except for ./rustc/lib/rustlib/aarch64-unknown-linux-gnu/bin/rust-objcopy which is an x86_64 executable.

$ file ./rustc/lib/rustlib/aarch64-unknown-linux-gnu/bin/rust-objcopy
./rustc/lib/rustlib/aarch64-unknown-linux-gnu/bin/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]=285124b3756870de665b8585d6c9cb3a72a13eca, for GNU/Linux 3.2.0, not stripped

I expected to see this happen to be a aarch executable

Activity

  1. added
    C-bug
    on Mar 25, 2025
  2. added
    needs-triage
    on Mar 25, 2025
  3. Stevenjin8 commented on Mar 25, 2025

    @Stevenjin8
    Author
  4. moxian commented on Mar 25, 2025

    @moxian
    Contributor

    @rustbot label: +T-bootstrap +O-aarch64

  5. added
    T-bootstrap
    O-AArch64
    on Mar 25, 2025
  6. changed the title [-]https://github.com/rust-lang/www.rust-lang.org/issues/2127[/-] [+]rust-objcopy is x86-64 executable in aarch64-unknown-linux-gnu[/+] on Mar 26, 2025
  7. changed the title [-]rust-objcopy is x86-64 executable in aarch64-unknown-linux-gnu[/-] [+]rust-objcopy is x86-64 executable on aarch64-unknown-linux-gnu[/+] on Mar 26, 2025
  8. removed
    needs-triage
    on Mar 26, 2025
  9. Noratrieb commented on Mar 26, 2025

    @Noratrieb
    Member

    the relevant logic is here:

    I don't see anything obvious standing out. note that rust-objcopy is only used for MacOS so this shouldn't cause problems in practice.

  10. Stevenjin8 commented on Mar 27, 2025

    @Stevenjin8
    Author

    Yeah its not a big issue for me. I just came across this and figured I'd make an issue just in case. Thanks for taking the time to look into this!

  11. alex-berger commented on Apr 14, 2025

    @alex-berger

    I don't see anything obvious standing out. note that rust-objcopy is only used for MacOS so this shouldn't cause problems in practice.

    @Noratrieb Actually, it causes problems in practice. For example in our use case where we are cross-compiling from Linux to macOS.

    ab566a1583b4:/workdir# uname -m
    aarch64
    ab566a1583b4:/workdir# file /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/rustlib/aarch64-unknown-linux-musl/bin/rust-objcopy
    /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/rustlib/aarch64-unknown-linux-musl/bin/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]=314f8cd18e99dc0dd8d0f1cd88dd44291cb566c0, for GNU/Linux 3.2.0, not stripped

    Which then leads to build failures/errors like this:

    error: unable to run `rust-objcopy`: Exec format error (os error 8)
    
  12. tindzk commented on May 16, 2025

    @tindzk

    I encountered the same issue as @alex-berger when cross-compiling to macOS. This can be used as a workaround on Alpine Linux:

    apk add llvm
    binary=/usr/local/rustup/toolchains/1.86.0-aarch64-unknown-linux-musl/lib/rustlib/aarch64-unknown-linux-musl/bin/rust-objcopy
    rm $binary
    ln -s /usr/bin/llvm-objcopy $binary
  13. lambdageek commented on Oct 29, 2025

    @lambdageek
    Contributor

    I think this is a duplicate of #145699 and is probably fixed by #145763

  14. Kobzol commented on Oct 29, 2025

    @Kobzol
    Member

    Yes, I also think so, thank you.

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-AArch64T-bootstrap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions