!lymvtcwDJ7ZA9Npq:lix.systems

Lix Development

417 Members
(Technical) development of Lix, the package manager, a Nix implementation. Please be mindful of ongoing technical conversations in this channel.140 Servers

Load older messages


SenderMessageTime
28 Jul 2025
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)so how can I get static initializers to run in plugins on macOS? :D20:53:33
@raitobezarius:matrix.orgraitobezarius (DECT: 7248) install_name_tool is not even a thing at this step I suppose? 20:53:46
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)or meson should do it for me?20:53:51
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)but if removing flat_namespace means moving everything to lazy initialization in the C++ codebase20:54:16
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)i'm not going to do that cleanup20:54:19
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)i'd rather take this or disable the entire plugin feature for macOS20:54:26
@emilazy:matrix.orgemilyI believe the static initializers should run before any other code in the loaded library20:56:44
@emilazy:matrix.orgemilythough after a quick Google, it may be that you are doing the linking a bit wrong20:57:06
@emilazy:matrix.orgemilye.g. https://github.com/ziglang/zig/issues/13319 https://issues.chromium.org/issues/4027645620:57:21
@emilazy:matrix.orgemily (I haven't tried using static initializers in a dlopen()ed library myself so I have no particular expertise here) 20:57:31
@emilazy:matrix.orgemily (my guess is that if -flat_namespace fixes it it's a cursed side effect) 20:57:51
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)
Static initializers in Rust are not supported and do not work
correctly on Apple platforms, failing compilation and even crashing
lld on iOS.

Replace the Rust-side static initializer with the use of linkme to
collect the registration functions and use a C++ static initializer
to do the registration of the Rust tests.
20:59:14
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)promising20:59:15
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)

Dyld sees the first padding nulllptr and stops processing initializers further.

21:00:00
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)exciting21:00:01
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)the end of the chromium thread being "this still doesn't work"21:01:19
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)I think I will need help on this because I don't have the time budget to go down on a linker journey with Apple macOS21:01:38
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)We can track the usage of flat_namespace as wrong and as an issue, document what we know and process this async21:02:02
@raitobezarius:matrix.orgraitobezarius (DECT: 7248) https://gerrit.lix.systems/c/lix/+/3698/26 awesome 21:08:04
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)the CI passed but my tests did not21:08:08
@jade_:matrix.orgjade_that looks right, no?21:08:09
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)
In reply to @jade_:matrix.org
that looks right, no?
the underscore yes
21:08:18
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)the defined yes21:08:22
@jade_:matrix.orgjade_oh yeah it does that21:08:25
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)dlopening it with two level namespaces does not run the static initializers21:08:40
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)i cannot see logs, i cannot register store21:08:45
@raitobezarius:matrix.orgraitobezarius (DECT: 7248)the plugin is literally useless21:08:49
@jade_:matrix.orgjade_you shouldn't need/want static initializers is the thing21:09:01
@jade_:matrix.orgjade_we are trying to kill those and nix_plugin_entry is guaranteed to be called21:09:11
@jade_:matrix.orgjade_so anything that you'd like to statically initialize can be initialized with that21:10:17

Show newer messages


Back to Room ListRoom Version: 10