Skip to content

Do not link statically against libc by default for musl targets #314

Description

@joerg-krause

By default libc is linked statically for musl targets except for the MIPS architecture: https://github.com/rust-lang/libc/blob/master/src/unix/mod.rs#L197-L200.

This is a problem for custom musl targets like ARM: https://github.com/joerg-krause/rust-cross-libs/blob/master/cfg/armv5te-unknown-linux-musl.json

By design, it's wrong to depend on the architecture if linking is done dynamically or statically. It should depend on the value of dynamic_linking: https://github.com/rust-lang/rust/blob/master/src/librustc_back/target/mod.rs#L450.

Activity

  1. alexcrichton commented on Jun 12, 2016

    @alexcrichton
    Member

    This is somewhat related to #290 as well which is basically saying that there's not a great way to control how libc is linked today, unfortunately.

  2. joerg-krause commented on Jun 14, 2016

    @joerg-krause
    ContributorAuthor

    Is it possible to use the existing dynamic_linking to check how libc should be linked?

  3. alexcrichton commented on Jun 14, 2016

    @alexcrichton
    Member

    Maybe? I'm not sure how invasive of a compiler change that'd end up being... (and it'd definitely be kinda randomly in the back of the compiler)

  4. alexcrichton commented on Nov 16, 2016

    @alexcrichton
    Member
  5. added a commit that references this issue on Mar 26, 2017
  6. added a commit that references this issue on Apr 28, 2020
    47f06df
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions