From ec2c972acc143a4df5328a1ae8b390d876dfc058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20Kemetm=C3=BCller?= Date: Tue, 19 Feb 2019 19:28:55 +0100 Subject: [PATCH] cudatoolkit: Fix GUI applications This fixes the following error when starting nvvp or nsight: ``` (java:23876): Gtk-WARNING **: 19:12:17.777: Unable to locate theme engine in module_path: "adwaita", A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007f957f7b67fe, pid=23876, tid=140281059333888 JRE version: Java(TM) SE Runtime Environment (8.0_77-b03) (build 1.8.0_77-b03) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.77-b03 mixed mode linux-amd64 compressed oops) Problematic frame: C [libpixbufloader-bmp.so+0x27fe] gdk_pixbuf__bmp_image_load_increment+0xeee ``` Since GDK_PIXBUF_MODULE_FILE should match the version we actually link to, we override the environment variable using the one provided by the gdk_pixbuf setup-hook. --- .../compilers/cudatoolkit/default.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/cudatoolkit/default.nix b/pkgs/development/compilers/cudatoolkit/default.nix index f0570568f519..80c0576a9054 100644 --- a/pkgs/development/compilers/cudatoolkit/default.nix +++ b/pkgs/development/compilers/cudatoolkit/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, makeWrapper, fetchurl, requireFile, perl, ncurses5, expat, python27, zlib , gcc48, gcc49, gcc5, gcc6, gcc7 -, xorg, gtk2, glib, fontconfig, freetype, unixODBC, alsaLib, glibc +, xorg, gtk2, gdk_pixbuf, glib, fontconfig, freetype, unixODBC, alsaLib, glibc }: let @@ -40,7 +40,7 @@ let outputs = [ "out" "lib" "doc" ]; nativeBuildInputs = [ perl makeWrapper ]; - + buildInputs = [ gdk_pixbuf ]; # To get $GDK_PIXBUF_MODULE_FILE via setup-hook runtimeDependencies = [ ncurses5 expat python zlib glibc xorg.libX11 xorg.libXext xorg.libXrender xorg.libXt xorg.libXtst xorg.libXi xorg.libXext @@ -66,6 +66,7 @@ let ''; installPhase = '' + runHook preInstall mkdir $out cd $(basename $src) export PERL5LIB=. @@ -118,6 +119,15 @@ let '' + lib.optionalString (lib.versionOlder version "8.0") '' # Hack to fix building against recent Glibc/GCC. echo "NIX_CFLAGS_COMPILE+=' -D_FORCE_INLINES'" >> $out/nix-support/setup-hook + '' + '' + runHook postInstall + ''; + + postInstall = '' + for b in nvvp nsight; do + wrapProgram "$out/bin/$b" \ + --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" + done ''; preFixup = '' @@ -148,7 +158,7 @@ let nvcc.profile) continue;; nsight_ee_plugins_manage.sh) continue;; uninstall_cuda_toolkit_6.5.pl) continue;; - computeprof|nvvp|nsight) continue;; # TODO: Broken + computeprof|nvvp|nsight) continue;; # GUIs don't feature "--version" *) echo "Executing '$f --version':"; ./$f --version;; esac done