staticlib libgcc_s dependency requirement since 1.21.0 (nightly-2017-08-24) · Issue #55120 · rust-lang/rust (original) (raw)
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