From a666b155725da3033fbfae99834bec0b6752911c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Sun, 4 Jul 2021 23:56:19 +0000 Subject: [PATCH] argp-standalone: Add `-fPIC`. Fixes `pkgsMusl.elfutils` failing with `recompile with -fPIC`. This was discovered trying to build `pkgsMusl.haskell.compiler.ghcHEAD`. --- pkgs/development/libraries/argp-standalone/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/argp-standalone/default.nix b/pkgs/development/libraries/argp-standalone/default.nix index 33b253718a7f..bb987d069a77 100644 --- a/pkgs/development/libraries/argp-standalone/default.nix +++ b/pkgs/development/libraries/argp-standalone/default.nix @@ -33,7 +33,11 @@ stdenv.mkDerivation { patchFlags = lib.optional stdenv.hostPlatform.isDarwin "-p0"; - preConfigure = lib.optionalString stdenv.hostPlatform.isLinux "export CFLAGS='-fgnu89-inline'"; + # For currently unknown reason, `-fPIC` has to be passed explicitly, otherwise + # downstream software like `elfutils` will get `recompile errors like: + # libargp.a(argp-help.o): relocation R_X86_64_PC32 against symbol `program_invocation_short_name' can not be used when making a shared object; recompile with -fPIC + # It seems that nixpkgs's on-by-default `-fPIC` is not in effect here. + preConfigure = lib.optionalString stdenv.hostPlatform.isLinux "export CFLAGS='-fgnu89-inline -fPIC'"; postInstall = '' mkdir -p $out/lib $out/include