Merge pull request #271923 from graham33/fix/nsys-ui

cudatoolkit: Replace vendored Qt plugins with symlinks
This commit is contained in:
Connor Baker 2023-12-13 08:32:07 -05:00 committed by GitHub
commit 6458f9f1f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -258,7 +258,7 @@ backendStdenv.mkDerivation rec {
rm $out/host-linux-x64/libstdc++.so*
''}
${
lib.optionalString (lib.versionAtLeast version "11.8")
lib.optionalString (lib.versionAtLeast version "11.8" && lib.versionOlder version "12")
# error: auto-patchelf could not satisfy dependency libtiff.so.5 wanted by /nix/store/.......-cudatoolkit-12.0.1/host-linux-x64/Plugins/imageformats/libqtiff.so
# we only ship libtiff.so.6, so let's use qt plugins built by Nix.
# TODO: don't copy, come up with a symlink-based "merge"
@ -266,6 +266,21 @@ backendStdenv.mkDerivation rec {
rsync ${lib.getLib qt6Packages.qtimageformats}/lib/qt-6/plugins/ $out/host-linux-x64/Plugins/ -aP
''
}
${
lib.optionalString (lib.versionAtLeast version "12")
# Use Qt plugins built by Nix.
''
for qtlib in $out/host-linux-x64/Plugins/*/libq*.so; do
qtdir=$(basename $(dirname $qtlib))
filename=$(basename $qtlib)
for qtpkgdir in ${lib.concatMapStringsSep " " (x: qt6Packages.${x}) ["qtbase" "qtimageformats" "qtsvg" "qtwayland"]}; do
if [ -e $qtpkgdir/lib/qt-6/plugins/$qtdir/$filename ]; then
ln -snf $qtpkgdir/lib/qt-6/plugins/$qtdir/$filename $qtlib
fi
done
done
''
}
rm -f $out/tools/CUDA_Occupancy_Calculator.xls # FIXME: why?
@ -336,6 +351,20 @@ backendStdenv.mkDerivation rec {
wrapProgram "$out/bin/$b" \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
done
${
lib.optionalString (lib.versionAtLeast version "12")
# Check we don't have any lurking vendored qt libraries that weren't
# replaced during installPhase
''
qtlibfiles=$(find $out -name "libq*.so" -type f)
if [ ! -z "$qtlibfiles" ]; then
echo "Found unexpected vendored Qt library files in $out" >&2
echo $qtlibfiles >&2
echo "These should be replaced with symlinks in installPhase" >&2
exit 1
fi
''
}
'';
# cuda-gdb doesn't run correctly when not using sandboxing, so