rustls / rustls-ffi

Use Rustls from any language
Other
124 stars 31 forks source link

improved handling of static libraries list #313

Open jsha opened 1 year ago

jsha commented 1 year ago

When we produce a library, it relies on a number of symbols that come from other libraries we expect to link against. For instance, on Linux our library should be linked with:

-lrustls -lgcc_s -lutil -lrt -lpthread -lm -ldl -lc

Mainly these dependencies come from the Rust standard library, which, for instance, requires pthread for its threading capabilities. I believe they can also come from our set of transitive dependencies (need to check).

We can get this list of libraries from rustc --print native-static-libs.

We document the list in our README, and have a test that it remains up-to-date across rustc versions. Across recent rustc releases, that test has flapped a bit, particularly with the inclusion / un-inclusion of legacy_stdio_definitions.lib (which occurs in two places in the linking list for Windows).

We should run --print native-static-libs across several recent rustc versions and see how its value has changed, particularly with an eye towards how it affects MSRV. Also it's worth noting: in my experience not all of the listed libraries are actually required to link rustls; it's a conservative set. So for instance we could start explicitly ignoring certain of them.

We should also check the issue / PR history for rustc and maybe file an issue to better understand whether legacy_stdio_definitions is meant to be included, and in what position(s).