This is mirroring the comment I've left on the Ubuntu bug: Unfortunately my first attempt at a workaround was indeed failing to address the issue, but as far as I am aware only because there are multiple such failing tests.
I agree that injecting the dependency on the static library is not nice, but the linking was failing because that static library was passed to the linker last. I have noticed that it's dependencies come after it, so injecting `-lc` there did produce the correct command line at least for that one test. As far as it being a rustc issue, I am only 50/50 because rustc doesn't necessarily guarantee that internally it always is linking against libc, and it also cannot know that external dependencies passed to it are really written in C. Providing such guarantees as "always link against libc and do so last" is ultimately for the Rustc authors to decide. Also Meson does always know that it is passing libraries written in C to rustc, so maybe it should always internally mark such libraries as dependent on libc? Ultimately the proper place to fix this is for the rustc and/or meson authors to decide, I would just like to get Ubuntu moving forward.