For cross-building libstd (for use e.g. with miri), it would be great if one could make an rlib-only libstd build. This is because building a dylib invokes the native linker, and that fails when the target architectures is too foreign and/or not supported by the installed C toolchain. (Currently, we build libstd both as rlib and dylib.)
So my goal was to equip libstd with a feature flag to control whether it is built as a dylib (next to the rlib) or not. To this end, I patched collect_crate_types such that the crate types passed on the command-line and the one given as attributes are merged (instead of command-line taking precedence). That means I can use #![cfg_attr(dylib, crate-type = "dylib")] to make a dylib feature enable a dylib build. That seems to work, however, there is a problem: During bootstrap, rustbuild uses cargo's stamp file to determine which files to copy into the sysroot, and that stamp file now no longer includes the libstd.so, breaking the build.
I wonder if there is maybe a better way to achieve an rlib-only libstd build?
Cc @eddyb @alexcrichton any advice?
For cross-building libstd (for use e.g. with miri), it would be great if one could make an rlib-only libstd build. This is because building a dylib invokes the native linker, and that fails when the target architectures is too foreign and/or not supported by the installed C toolchain. (Currently, we build libstd both as rlib and dylib.)
So my goal was to equip libstd with a feature flag to control whether it is built as a dylib (next to the rlib) or not. To this end, I patched
collect_crate_typessuch that the crate types passed on the command-line and the one given as attributes are merged (instead of command-line taking precedence). That means I can use#![cfg_attr(dylib, crate-type = "dylib")]to make adylibfeature enable a dylib build. That seems to work, however, there is a problem: During bootstrap, rustbuild uses cargo's stamp file to determine which files to copy into the sysroot, and that stamp file now no longer includes thelibstd.so, breaking the build.I wonder if there is maybe a better way to achieve an rlib-only libstd build?
Cc @eddyb @alexcrichton any advice?