xrootd: fix plugin loading on Linux (#289140)

This commit is contained in:
Dmitry Kalinkin 2024-02-17 15:38:01 -05:00 committed by GitHub
parent ee7f324c60
commit cb6f36e8ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 18 deletions

View file

@ -214,13 +214,10 @@ stdenv.mkDerivation rec {
# suppress warnings from compilation of the vendored clang to avoid running into log limits on the Hydra
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-Wno-shadow" "-Wno-maybe-uninitialized" ];
# Workaround the xrootd runpath bug #169677 by prefixing [DY]LD_LIBRARY_PATH with ${lib.makeLibraryPath xrootd}.
# TODO: Remove the [DY]LDLIBRARY_PATH prefix for xrootd when #200830 get merged.
postInstall = ''
for prog in rootbrowse rootcp rooteventselector rootls rootmkdir rootmv rootprint rootrm rootslimtree; do
wrapProgram "$out/bin/$prog" \
--set PYTHONPATH "$out/lib" \
--set ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH "$out/lib:${lib.makeLibraryPath [ xrootd ]}"
--set PYTHONPATH "$out/lib"
done
# Make ldd and sed available to the ROOT executable by prefixing PATH.
@ -229,8 +226,7 @@ stdenv.mkDerivation rec {
gnused # sed
stdenv.cc # c++ ld etc.
stdenv.cc.libc # ldd
]}" \
--prefix ${lib.optionalString stdenv.hostPlatform.isDarwin "DY"}LD_LIBRARY_PATH : "${lib.makeLibraryPath [ xrootd ]}"
]}"
# Patch thisroot.{sh,csh,fish}

View file

@ -135,22 +135,13 @@ stdenv.mkDerivation (finalAttrs: {
"-DENABLE_VOMS=${if stdenv.isLinux then "TRUE" else "FALSE"}"
];
# Workaround the library-not-found issue
# happening to binaries compiled with xrootd libraries.
# See #169677
preFixup = ''
makeWrapperArgs+=("--prefix" "${lib.optionalString stdenv.hostPlatform.isDarwin "DY"}LD_LIBRARY_PATH" ":" "${placeholder "out"}/lib")
'';
postFixup = ''
while IFS= read -r FILE; do
wrapProgram "$FILE" "''${makeWrapperArgs[@]}"
done < <(find "$bin/bin" -mindepth 1 -maxdepth 1 -type f,l -perm -a+x)
'' + lib.optionalString (externalEtc != null) ''
postFixup = lib.optionalString (externalEtc != null) ''
moveToOutput etc "$etc"
ln -s ${lib.escapeShellArg externalEtc} "$out/etc"
'';
dontPatchELF = true; # shrinking rpath will cause runtime failures in dlopen
meta = with lib; {
description = "High performance, scalable fault tolerant data access";
homepage = "https://xrootd.slac.stanford.edu";