Rust: linking static C/C++ libraries with LTO

The Backstory I wasted entire afternoon today trying to figure this out, so here&rsquo;s a quick note for future reference - hopefully to save someone else&rsquo;s afternoon. Today, I was working on adding Rust bindings for an internal C++ library. The C++ library itself is built using CMake and produces a statically-linked library, let&rsquo;s call it libfoo.a . I used the cxx crate to generate…