Linkage order changing on nightly

On nightly we just had #28605 land in the compiler, and this is a tweaking to how the order of native libraries are linked with respect to upstream Rust dependencies. While this shouldn’t in theory cause much downstream breakage, if you start seeing link errors this might be why!

Some more details and rationale about the change can be found on the PR, but I’d like to give a heads up to everyone that this is technically a breaking change from the compiler’s previous behavior. Specifically, if you were relying on a downstream library to link in a native dependency required by an upstream library, that is no longer guaranteed to link correctly.

This was primarily done in the past because the name of a native library may not be known until the end of a compilation, but since then the compiler has grown the -l flag and build scripts have come into existence, so there shouldn’t be any need for this use case.

tl;dr; If you see a link error about undefined symbols in a native library you’re linking, you may want to make sure that the native library is being linked by the library that requires it, not by a downstream consumer.

If you have any problems please feel free to post them here, and I’ll see if I can’t help out!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.