Merge pull request #250639 from SomeoneSerge/autoaddopenglrunpath

cudaPackages.autoAddOpenGLRunpathHook: don't skip shared libraries

authored by

Connor Baker and committed by
GitHub
46e52862 50097d75

+7 -3
+7 -3
pkgs/development/compilers/cudatoolkit/auto-add-opengl-runpath-hook.sh
··· 2 2 # Run addOpenGLRunpath on all dynamically linked, ELF files 3 3 echo "Sourcing auto-add-opengl-runpath-hook" 4 4 5 + elfHasDynamicSection() { 6 + patchelf --print-rpath "$1" >& /dev/null 7 + } 8 + 5 9 autoAddOpenGLRunpathPhase() ( 6 10 local outputPaths 7 11 mapfile -t outputPaths < <(for o in $(getAllOutputNames); do echo "${!o}"; done) 8 12 find "${outputPaths[@]}" -type f -executable -print0 | while IFS= read -rd "" f; do 9 13 if isELF "$f"; then 10 14 # patchelf returns an error on statically linked ELF files 11 - if patchelf --print-interpreter "$f" >/dev/null 2>&1; then 15 + if elfHasDynamicSection "$f" ; then 12 16 echo "autoAddOpenGLRunpathHook: patching $f" 13 17 addOpenGLRunpath "$f" 14 - elif [ -n "${DEBUG-}" ]; then 15 - echo "autoAddOpenGLRunpathHook: skipping ELF file $f" 18 + elif (( "${NIX_DEBUG:-0}" >= 1 )) ; then 19 + echo "autoAddOpenGLRunpathHook: skipping a statically-linked ELF file $f" 16 20 fi 17 21 fi 18 22 done