Increase of 7MB in the size of the Lix derivation on Linux #308
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
ux
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#308
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From https://github.com/NixOS/nixpkgs/pull/310194 we have the following size reports:
The Linux derivation size are fishy.
I built the derivation with
ninjaFlags = [ "-v" ];
and:... no optimization flags?! That would probably explain it.
…right, mesonConfigurePhase sets
mesonBuildType
/-Dbuild_type=plain
by default…With
mesonBuildType = "release";
patched in to the nixpkgs expression (and checked that -O3 appears in the build flags):So that alone doesn't fix it. Should probably still be fixed (and also in Lix's
package.nix
maybe?).Current hypothesis: this is because Nix >= 2.10 on GNU stdenvs uses
-flto
which Lix doesn't seem to use. This would explain why the discrepancy is only happening on the Linux builds and not the Darwin builds.with
-Db_lto=true
andmesonBuildType = "release";
:Getting there.
since you say this: lix should really enable lto in nixpkgs. lto makes quite a difference in eval performance (which is why we added it to nix in the first place 🫠)
The last 3MB are in very large part attributable to the Rust lix-doc being statically linked into libnixcmd. It's dragging in a good chunk of runtime, from what I can tell. Not exactly sure what can be done there since it's outside of my expertise - maybe it's dead code that could be eliminated with
-Wl,--gc-sections
and the equivalent of-ffunction-sections
on the Rust side of things?Could also treat as WAI since at least we have an explanation now.
@delroth Perfect, that makes total sense to me.
Should
package.nix
and/orlix-project/nixos-module
also enable it? AFAICT they currently don't, but I might be mistaken.package.nix
probably shouldn't (but should give the option), the module may want to override this choice to give a close-to-nixos build resultnow hold your horses though, because release is -O3 and I don't think we want that configuration to even be allowed after we found that gcc warning bug on O3. i think you want debugoptimized which is O2 and has debug info available.
For the nixpkgs release?
In general. I am not convinced that O3 is sound in gcc given that warning implies it thinks something can be uninit when it can't be.
@jade do you have a ref to that warning you're talking about? I didn't see it on my side when building in
release
mode.In general I'd say that building with
build_type = release
is a fairly intuitive thing to do, and users will try and do it. So if we think the set of flags used in that mode is wrong, they should probably be fixed in the Meson config. WDYT?yes that would be #46
note that meson doesn't allow you to force a build type or optimization level within
meson.build
; you can only default it if not specified (and the meson hook in Nixpkgs never uses the default). You can add the-O2
flags yourself, but Meson will probably emit a warning about it and/or apply the flags from its configured build type/opt levelcan we detect people setting optimization to 3 and throw an error? that's my preference i think.
Doesn't that seem premature when there is no evidence of harm from -O3? AFAICT all that has been reported so far is spurious warnings - all Lix tests are still passing.
The thing about the warning being reported is it implies there's an unsound optimization pass, or that that particular warning warns on legit code. And I'm mildly scared of it being the former case.