From e54d4c9381492d44a69469a0e719fea50e9914f3 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Thu, 30 May 2024 17:10:10 -0600 Subject: 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 --- src/libexpr/meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libexpr') diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 9a18c7ab3..e60a85b5d 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -162,6 +162,16 @@ liblixexpr = declare_dependency( link_with : libexpr, ) +# FIXME: remove when https://git.lix.systems/lix-project/lix/issues/359 is fixed. +if is_static + liblixexpr_mstatic = declare_dependency( + include_directories : include_directories('.'), + link_whole : libexpr, + ) +else + liblixexpr_mstatic = liblixexpr +endif + # FIXME: not using the pkg-config module because it creates way too many deps # while meson migration is in progress, and we want to not include boost here configure_file( -- cgit v1.2.3