From 17577f6b54d71875b6c14edb31dbd474282d663e Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sat, 8 Jan 2022 09:14:35 -0500 Subject: [PATCH] pkgsStatic.libredirect: print error message why it won't work The whole point of libredirect is manipulation with LD_PRELOAD, which is not supposed to work on static builds. --- pkgs/build-support/libredirect/default.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/libredirect/default.nix b/pkgs/build-support/libredirect/default.nix index f87c6d23dd79..0c86ea9a7930 100644 --- a/pkgs/build-support/libredirect/default.nix +++ b/pkgs/build-support/libredirect/default.nix @@ -1,6 +1,22 @@ -{ stdenv, lib, coreutils }: +{ stdenv, runCommand, lib, coreutils }: -stdenv.mkDerivation rec { +if stdenv.hostPlatform.isStatic +then throw '' + libredirect is not available on static builds. + + Please fix your derivation to not depend on libredirect on static + builds, using something like following: + + nativeBuildInputs = + lib.optional (!stdenv.buildPlatform.isStatic) libredirect; + + and disable tests as necessary, although fixing tests to work without + libredirect is even better. + + libredirect uses LD_PRELOAD feature of dynamic loader and does not + work on static builds where dynamic loader is not used. + '' +else stdenv.mkDerivation rec { pname = "libredirect"; version = "0";