I have a crate that needs to export a staticlib and a lib, but since LTO isn't supported for lib targets, I end up with a big staticlib. This issue is discussed here:
It's mentioned there that this can be worked around by making a wrapper crate that wraps the lib and exports the staticlib, but I'm not really sure what that would look like. Do I need to actually make a new lib.rs file that just re-exports the lib crate? Is there some other magic I should have?
Assuming that the original crate is called my_lib, you can make a new crate with the staticlib crate type which depends on my_lib. This new crate only needs to contains use my_lib; to force my_lib to be linked in. (rustc will likely warn, but you can disable that warning) You don't need to re-export anything as rustc will export all #[no_mangle] functions from a staticlib, even if they originate from dependencies.