-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cudaPackages.autoAddOpenGLRunpathHook: fix to skip unsupported #245789
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
# Run autoOpenGLRunpath on all files | ||
# shellcheck shell=bash | ||
# Run addOpenGLRunpath on all dynamically linked, ELF files | ||
echo "Sourcing auto-add-opengl-runpath-hook" | ||
|
||
autoAddOpenGLRunpathPhase () { | ||
# TODO: support multiple outputs | ||
for file in $(find ${out,lib,bin} -type f); do | ||
addOpenGLRunpath $file | ||
done | ||
} | ||
autoAddOpenGLRunpathPhase() ( | ||
local outputPaths | ||
mapfile -t outputPaths < <(for o in $(getAllOutputNames); do echo "${!o}"; done) | ||
find "${outputPaths[@]}" -type f -executable -print0 | while IFS= read -rd "" f; do | ||
if isELF "$f"; then | ||
# patchelf returns an error on statically linked ELF files | ||
if patchelf --print-interpreter "$f" >/dev/null 2>&1; then | ||
echo "autoAddOpenGLRunpathHook: patching $f" | ||
addOpenGLRunpath "$f" | ||
elif [ -n "${DEBUG-}" ]; then | ||
echo "autoAddOpenGLRunpathHook: skipping ELF file $f" | ||
fi | ||
fi | ||
done | ||
) | ||
|
||
if [ -z "${dontUseAutoAddOpenGLRunpath-}" ]; then | ||
echo "Using autoAddOpenGLRunpathPhase" | ||
postFixupHooks+=(autoAddOpenGLRunpathPhase) | ||
echo "Using autoAddOpenGLRunpathPhase" | ||
postFixupHooks+=(autoAddOpenGLRunpathPhase) | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,36 +104,30 @@ in gcc11Stdenv.mkDerivation rec { | |
|
||
hardeningDisable = [ "all" ]; | ||
|
||
strictDeps = true; | ||
|
||
nativeBuildInputs = [ | ||
addOpenGLRunpath | ||
# autoAddOpenGLRunpathHook does not actually depend on or incur any dependency | ||
# of cudaPackages. It merely adds an impure, non-Nix PATH to the RPATHs of | ||
# executables that need to use cuda at runtime. | ||
cudaPackages_12.autoAddOpenGLRunpathHook | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why hardcode the vetsion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This package depends on 3 different versions of |
||
|
||
cmake | ||
git | ||
python3 | ||
]; | ||
|
||
jsoncpp-static | ||
jsoncpp-static.dev | ||
libevent-nossl-static | ||
libevent-nossl-static.dev | ||
buildInputs = [ | ||
plog.dev # header-only | ||
tclap_1_4 # header-only | ||
]; | ||
|
||
buildInputs = [ | ||
catch2 | ||
fmt_9 | ||
jsoncpp-static | ||
libevent-nossl-static | ||
yaml-cpp | ||
]; | ||
|
||
# libcuda.so must be found at runtime because it is supplied by the NVIDIA | ||
# driver. autoAddOpenGLRunpathHook breaks on the statically linked exes. | ||
postFixup = '' | ||
find "$out/bin" "$out/lib" -type f -executable -print0 | while IFS= read -r -d "" f; do | ||
if isELF "$f" && [[ $(patchelf --print-needed "$f" || true) == *libcuda.so* ]]; then | ||
addOpenGLRunpath "$f" | ||
fi | ||
done | ||
''; | ||
|
||
disallowedReferences = lib.concatMap (x: x.pkgSet) cudaPackageSetByVersion; | ||
|
||
meta = with lib; { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a formatting change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rewrite uses 2-space tabs so this is to make it consistent.