Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
abcfy2 opened this issue Jan 3, 2021 · 2 comments
Labels
C-bug Category: bug

Comments

@abcfy2
Copy link

abcfy2 commented Jan 3, 2021

Problem
From issue: cross-rs/cross#504

I find it's an cargo 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)

@abcfy2 abcfy2 added the C-bug Category: bug label Jan 3, 2021
@abcfy2 abcfy2 changed the title Target mips-unknown-linux-musl and mipsel-unknown-linux-musl is not statically linked. Target mips-unknown-linux-musl and mipsel-unknown-linux-musl are not statically linked. Jan 3, 2021
jakubfijalkowski added a commit to jakubfijalkowski/kvenv that referenced this issue Jan 3, 2021
@alexcrichton
Copy link
Member

Thanks for the report! I don't think that this is a Cargo issue but rather a rustc issue perhaps?

@abcfy2
Copy link
Author

abcfy2 commented Jan 4, 2021

OK. So I will submit this issue to rust repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants