Skip to content

staticlib libgcc_s dependency requirement since 1.21.0 (nightly-2017-08-24) #55120

Open

Description

Hi Rust team!

Since Rust 1.21.0 and nightly-2017-08-24 a new dependency, libgcc_s, is needed for static libraries we're building for gnu, musl and freebsd targets.

This requirement slipped past us during a recent upgrade because the build process did not inform us of this new requirement. (I see this is an option --print=native-static-libs in the latest nightly (nightly-2018-10-10) and unreleased 1.22.0.)

The change was only visible to us upon linking to an Elixir app as a NIF during a two stage build process where on the second stage this particular library was absent. The error we see is:

Error loading shared library libgcc_s.so.1: No such file or directory (needed by /app/lib/elixir_package-0.0.1/priv/elixir_package_extension.so)

From what I can tell this commit and its parent PR (#40113) seem related to this issue. According to the commit and PR the libgcc_s link requirement gets added for the musl target/to support dynamically-linked musl targets.

However, we see this requirement listed on the latest nightly for the gnu and freebsd targets as well.

Was this libgcc_s link requirement intended for the gnu and freebsd targets as well? Or was this an unintended change?

Reproducible example project

To track the issue down I created an example project with a reproducible state. It allows building an example Rust staticlib for musl and link it to Elixir as a NIF. Instructions can be found in the README. I'm adding this to add context and show a scenario to show how this requirement breaks between versions.

https://github.com/tombruijn/rust-elixir-linking-issue-example-project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions