Open kchibisov opened 7 months ago
proc macros, build scripts, and their dependencies get built for your host computer while everything else gets built for the target. For most people, these are probably the same thing. In dealing with this, cargo tries to unify them as much as possible to remove redundancy but there are likely cases where it can't or isn't yet. This unification is a fairly complicated task.
I wonder if this is related to #11252. I know a previous version of it caused even more duplicate builds but don't remember if that still had some or not.
This test might be related:
So this might be the case:
alacritty_config_derive
was built with the release
profile.alacritty_config_derive
is used by alacritty
as a proc-macro, so it was built as a build dependency, which uses a special build profile.Try adding this. It should combine them into one rustc invocation.
[profile.release.package.alacritty_config_derive]
opt-level = 0
debug = 0
I'd like to add that I've initially noticed it with sqlx
and it's macros
feature, where the difference is around ~70 crates for release/debug build(I don't have any profile and it's not a workspace).
Try adding this. It should combine them into one rustc invocation.
Yeah, that fixes it. But I'd assume that the macro itself will run slower.
Problem
I've recently noticed a difference when building alacritty in debug and release build that I have
216
deps in debug, but217
in release. I've started investigating and found out that some proc macros are being built twice, but with slight difference (not in features though).In the log I found the following for
--release
build (--debug has just one of these lines).And the difference in each line is only the following:
which is just different optimization level, but I build debug and release at the same time when doing release, so it sounds weird? I've tried removing
profile
in workspace and it didn't help.Steps
Then you can sort the files, remove empty lines and some garbage, and
diff
them to discover the diff in basically one line and after you remove it the end diff is the same with the same amount of occurrences foralacritty_config_derive
.Possible Solution(s)
No response
Notes
I've seen https://github.com/rust-lang/cargo/issues/10645 , but I don't have different features and I'm not sure how to solve that, it seems like some
.so
artifacts are not used at all.Version