Static builds fail #306

Closed
opened 2024-05-12 13:50:55 +00:00 by raito · 10 comments
Owner

Traces: https://0x0.st/XKiG.txt

Happened during https://github.com/NixOS/nixpkgs/pull/310194.

Reproducer: nix-build -A lixStatic on that PR.

Traces: https://0x0.st/XKiG.txt Happened during https://github.com/NixOS/nixpkgs/pull/310194. Reproducer: `nix-build -A lixStatic` on that PR.
Author
Owner
cc @delroth
raito added the
Area/build-packaging
label 2024-05-12 13:53:32 +00:00
delroth self-assigned this 2024-05-12 17:56:55 +00:00
Author
Owner

@delroth FYI, it was found out that it's related to passing -shared and -static to the plugin build. It should probably be skipped at the Meson level, i.e. dynamic plugin tests make no sense for static builds (dlopen for musl returns dummy values, NULL or something IIRC).

@delroth FYI, it was found out that it's related to passing `-shared` and `-static` to the plugin build. It should probably be skipped at the Meson level, i.e. dynamic plugin tests make no sense for static builds (`dlopen` for musl returns dummy values, NULL or something IIRC).
Member

Yeah, that was fairly obvious and I already have a patch for this. But there are further problems with unit tests and C++ constructors causing store registration to sometimes not work (and that's what I'm currently debugging).

Yeah, that was fairly obvious and I already have a patch for this. But there are further problems with unit tests and C++ constructors causing store registration to sometimes not work (and that's what I'm currently debugging).
Member

https://gerrit.lix.systems/c/lix/+/1106/1 fixes the first trivial part of the problem.

Then libstore tests fail because the linker is pruning .o files for store implementations due to them not being referenced. This is because store registrations are done via static initializers instead of having e.g. an init function being called by libstore's init, so unless the linker is forced to keep those .o files via (for example) Meson's link_whole it doesn't. But if you make libstore link_whole, that breaks a whole bunch of things, for example linking with libexpr because libexpr depends on libstore but Meson isn't transitively passing dependencies? I think?

Anyway, it's a fairly deep rabbit hole. Dropping for now.

https://gerrit.lix.systems/c/lix/+/1106/1 fixes the first trivial part of the problem. Then libstore tests fail because the linker is pruning .o files for store implementations due to them not being referenced. This is because store registrations are done via static initializers instead of having e.g. an init function being called by libstore's init, so unless the linker is forced to keep those .o files via (for example) Meson's `link_whole` it doesn't. But if you make libstore link_whole, that breaks a whole bunch of things, for example linking with libexpr because libexpr depends on libstore but Meson isn't transitively passing dependencies? I think? Anyway, it's a fairly deep rabbit hole. Dropping for now.
delroth removed their assignment 2024-05-12 21:08:29 +00:00
Owner

why did this work in the first place?! :O cursed

~~like, did this work properly in make? because you still should need to give whole-archive right?~~oh i see we have some staticlibs that get linked together into a shared lib. yeah, hm. right.

why did this work in the first place?! :O cursed ~~like, did this work properly in make? because you still should need to give whole-archive right?~~oh i see we have some staticlibs that get linked together into a shared lib. yeah, hm. right.
Member

Blocked on #359 (most likely).

Blocked on https://git.lix.systems/lix-project/lix/issues/359 (most likely).
Member

Also, is static builds availability something that should block release? I'd be tempted to say it's a major regression tbf.

Also, is static builds availability something that should block release? I'd be tempted to say it's a major regression tbf.
Owner

We::Qyriad can make it a priority

We::Qyriad can make it a priority
qyriad self-assigned this 2024-05-29 20:34:59 +00:00
qyriad added this to the v2.90 milestone 2024-05-29 23:37:19 +00:00
qyriad added the
release-blocker
label 2024-05-29 23:37:25 +00:00
Owner

We have this basically working; just need to clean it up and make sure the logic doesn't break anything else

We have this basically working; just need to clean it up and make sure the logic doesn't break anything else
qyriad changed title from Static builds fails during plugin tests to Static builds fail 2024-05-30 01:06:25 +00:00
jade added this to the Release engineering project 2024-05-30 02:41:00 +00:00
Owner
Will be fixed by https://gerrit.lix.systems/c/lix/+/1360/3
Sign in to join this conversation.
No milestone
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#306
No description provided.