Skip to content

Commit

Permalink
Fix some BSD builds missing pthread functions
Browse files Browse the repository at this point in the history
In addition to adding the missing thread deps in the last commit, we
also appear to need to skip `-Wl,--as-needed` flags that Meson wants to
use, but doesn't work with our *BSD toolchains.

See mesonbuild/meson#3593
  • Loading branch information
Ericson2314 committed Jul 22, 2024
1 parent d3cee81 commit d39bbca
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packaging/dependencies.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ let
workDir = null;
};

# Work around weird `--as-needed` linker behavior with BSD, see
# https://github.com/mesonbuild/meson/issues/3593
bsdNoLinkAsNeeded = finalAttrs: prevAttrs: lib.optionalAttrs stdenv.hostPlatform.isBSD {
mesonFlags = [ (lib.mesonBool "b_asneeded" false) ] ++ prevAttrs.mesonFlags or [];
};

in
scope: {
inherit stdenv versionSuffix;
Expand Down Expand Up @@ -130,5 +136,8 @@ scope: {

inherit resolvePath filesetToSource;

mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
mkMesonDerivation = f: stdenv.mkDerivation
(lib.extends
(lib.composeExtensions bsdNoLinkAsNeeded localSourceLayer)
f);
}

0 comments on commit d39bbca

Please sign in to comment.