cargo hakari missing cfg-specific dependencies?
Closed this issue · 2 comments
I have this in some of my bin packages in my workspace:
[target.'cfg(target_env = "musl")'.dependencies]
# The allocator on musl is attrociously slow, so we use a custom one.
# Jemalloc doesn't work reliably on Aarch64 due to varying page size, so use
# the slightly slower mimalloc instead.
mimalloc.workspace = true
And in my virtual workspace manifest I have:
[workspace.dependencies]
# ...
mimalloc = "0.1.43"
# ...
For some reason mimalloc doesn't show up in the generated workspace_hack Cargo.toml
. I have the following in my hakari.toml
:
platforms = [
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"armv7-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabihf",
"i686-unknown-linux-gnu",
"i686-unknown-linux-musl",
"riscv64gc-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
]
So I really think that mimalloc should show up for the musl targets?
Thanks for the question! With hakari, by default a crate is only added to the workspace-hack if it is built with more than one feature set.
To always add dependencies to the workspace-hack you can use output-single-feature
: https://docs.rs/cargo-hakari/latest/cargo_hakari/config/index.html#output-single-feature
Ah, that makes sense. It was the only instance of this that I spotted, and it made me incorrectly suspect that cfg support wasn't working. My bad and thanks for taking time to answer.