Skip to content

Target mips-unknown-linux-musl and mipsel-unknown-linux-musl are not statically linked. #80693

Closed as not planned
@abcfy2

Description

@abcfy2

Here issue is from: rust-lang/cargo#9039

Meta

rustc --version --verbose:

rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-unknown-linux-gnu
release: 1.49.0

Problem

Target mips-unknown-linux-musl and mipsel-unknown-linux-musl are not statically linked, maybe it's an rustc issue?

Steps

  1. download build toolchain from: musl.cc
  2. cargo new cargo-hello && cd cargo-hello
  3. cargo build --target mips-unknown-linux-musl or cargo build --target mipsel-unknown-linux-musl
  4. file target/<target>/debug/cargo-hello

Here is my ~/.cargo/config

[target.aarch64-unknown-linux-musl]
linker = "/home/fengyu/projects/cross_prefix/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc"

[target.arm-unknown-linux-musleabi]
linker = "/home/fengyu/projects/cross_prefix/arm-linux-musleabi-cross/bin/arm-linux-musleabi-gcc"

[target.mips-unknown-linux-musl]
linker = "/home/fengyu/projects/cross_prefix/mips-linux-musl-cross/bin/mips-linux-musl-gcc"

[target.mips64-unknown-linux-muslabi64]
linker = "/home/fengyu/projects/cross_prefix/mips64-linux-musl-cross/bin/mips64-linux-musl-gcc"

[target.mips64el-unknown-linux-muslabi64]
linker = "/home/fengyu/projects/cross_prefix/mips64el-linux-musl-cross/bin/mips64el-linux-musl-gcc"

[target.mipsel-unknown-linux-musl]
linker = "/home/fengyu/projects/cross_prefix/mipsel-linux-musl-cross/bin/mipsel-linux-musl-gcc"

[target.x86_64-unknown-linux-musl]
linker = "/home/fengyu/projects/cross_prefix/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc"

I find only mips-unknown-linux-musl and mipsel-unknown-linux-musl are not staticlly linked.

$ echo aarch64-unknown-linux-musl arm-unknown-linux-musleabi mips-unknown-linux-musl mips64-unknown-linux-muslabi64 mips64el-unknown-linux-muslabi64 mipsel-unknown-linux-musl x86_64-unknown-linux-musl | xargs -n 1 rustup target add
$ echo aarch64-unknown-linux-musl arm-unknown-linux-musleabi mips-unknown-linux-musl mips64-unknown-linux-muslabi64 mips64el-unknown-linux-muslabi64 mipsel-unknown-linux-musl x86_64-unknown-linux-musl | xargs -n 1 cargo build --target
$ file target/*/debug/cargo-hello
target/aarch64-unknown-linux-musl/debug/cargo-hello:       ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, with debug_info, not stripped
target/arm-unknown-linux-musleabi/debug/cargo-hello:       ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped
target/mips64el-unknown-linux-muslabi64/debug/cargo-hello: ELF 64-bit LSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), statically linked, with debug_info, not stripped
target/mips64-unknown-linux-muslabi64/debug/cargo-hello:   ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), statically linked, with debug_info, not stripped
target/mipsel-unknown-linux-musl/debug/cargo-hello:        ELF 32-bit LSB pie executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-mipsel.so.1, with debug_info, not stripped
target/mips-unknown-linux-musl/debug/cargo-hello:          ELF 32-bit MSB pie executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-mips.so.1, with debug_info, not stripped
target/x86_64-unknown-linux-musl/debug/cargo-hello:        ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, with debug_info, not stripped

Notes

Output of cargo version: cargo 1.49.0 (d00d64df9 2020-12-05)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-target-specsArea: Compile-target specificationsC-bugCategory: This is a bug.O-MIPSTarget: MIPS processorsO-linuxOperating system: LinuxO-muslTarget: The musl libc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions