| 28 Jul 2025 |
emily | yes | 20:51:05 |
emily | it's very deprecated | 20:51:06 |
raitobezarius | if you teach me how to replace it, i'm glad | 20:51:13 |
emily | sorry I'm missing context I just saw -flat_namespace and started twitching | 20:51:24 |
raitobezarius | but right now i'm trying to understand why linux and darwin differs on giving a certificate to curl | 20:51:26 |
emily | so many headaches have resulted | 20:51:28 |
raitobezarius | In reply to @emilazy:matrix.org sorry I'm missing context I just saw -flat_namespace and started twitching it's ok, i'm ranting here to summon darwin expertise | 20:51:40 |
raitobezarius | and "don't do X or Y" | 20:51:43 |
emily | (I wish Linux had two-level namespaces) | 20:51:46 |
raitobezarius | and hopefully suggestions on how to do better | 20:51:48 |
emily | if you are trying to do preload type stuff I am not sure what the correct solution is (it may be "don't do that") | 20:52:11 |
emily | but maybe you can install_name_tool to adjust the internal name | 20:52:40 |
emily | with -id or such | 20:52:48 |
raitobezarius | what i'm seeing is | 20:53:06 |
raitobezarius | (a) if i set -flat_namespace, static initializers seems to run | 20:53:15 |
raitobezarius | (b) if i don't, they don't | 20:53:18 |
raitobezarius | so how can I get static initializers to run in plugins on macOS? :D | 20:53:33 |
raitobezarius | install_name_tool is not even a thing at this step I suppose? | 20:53:46 |
raitobezarius | or meson should do it for me? | 20:53:51 |
raitobezarius | but if removing flat_namespace means moving everything to lazy initialization in the C++ codebase | 20:54:16 |
raitobezarius | i'm not going to do that cleanup | 20:54:19 |
raitobezarius | i'd rather take this or disable the entire plugin feature for macOS | 20:54:26 |
emily | I believe the static initializers should run before any other code in the loaded library | 20:56:44 |
emily | though after a quick Google, it may be that you are doing the linking a bit wrong | 20:57:06 |
emily | e.g. https://github.com/ziglang/zig/issues/13319 https://issues.chromium.org/issues/40276456 | 20:57:21 |
emily | (I haven't tried using static initializers in a dlopen()ed library myself so I have no particular expertise here) | 20:57:31 |
emily | (my guess is that if -flat_namespace fixes it it's a cursed side effect) | 20:57:51 |
raitobezarius | 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 | promising | 20:59:15 |
raitobezarius |
Dyld sees the first padding nulllptr and stops processing initializers further.
| 21:00:00 |