diff options
author | Qyriad <qyriad@qyriad.me> | 2024-05-30 17:10:10 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-05-31 21:47:16 -0600 |
commit | e54d4c9381492d44a69469a0e719fea50e9914f3 (patch) | |
tree | 626b3ddceaefd2c2d133845a0248c2d126624907 /src/libutil/meson.build | |
parent | c7ca87461dff6892b166e46203024cb82bd89e55 (diff) |
build: fix static linking with a hack
This causes libstore, libexpr, libfetchers, and libutil to be linked
with -Wl,--whole-archive to executables, when building statically.
libstore for the store backends, libexpr for the primops, libfetchers
for the fetcher backends I assume(?), and libutil for the nix::logger
initializer (which notably shows in pre-main constructors when HOME is
not owned by the user. cursed.).
This workaround should be removed when #359 is fixed.
Fixes #306.
Change-Id: Ie9ef0154e09a6ed97920ee8ab23810ca5e2de84c
Diffstat (limited to 'src/libutil/meson.build')
-rw-r--r-- | src/libutil/meson.build | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/meson.build b/src/libutil/meson.build index cfdd0e52c..8c3377e76 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -155,3 +155,13 @@ liblixutil = declare_dependency( include_directories : include_directories('.'), link_with : libutil ) + +# FIXME: remove when https://git.lix.systems/lix-project/lix/issues/359 is fixed. +if is_static + liblixutil_mstatic = declare_dependency( + include_directories : include_directories('.'), + link_whole : libutil, + ) +else + liblixutil_mstatic = liblixutil +endif |