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