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.
This commit is contained in:
Josef Kemetmüller 2019-02-19 19:28:55 +01:00
parent f483974489
commit ec2c972acc

View file

@ -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