Skip to content
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

Segmentation fault: bzflag and Red Eclipse fail to run on non-NixOS, likely Mesa version mismatch #9840

Closed
joepie91 opened this issue Sep 13, 2015 · 44 comments

Comments

@joepie91
Copy link
Contributor

  • Platform: openSUSE 13.1, x86_64, XFCE
  • Nix version: 1.9 (stand-alone)
  • nixpkgs version: Git master
  • Error: Segmentation fault

After spending a lot of time yesterday debugging things with @ttuegel, it seems that there's a Mesa version mismatch issue between Nix and my OS, leading to certain games segfaulting on boot.

Whereas nixpkgs uses a 10.x version of Mesa, my system uses a 9.x version - specifically:

sven@linux-etoq:~/projects/nixpkgs/test/bzflag> zypper info Mesa-libGL1
Loading repository data...
Reading installed packages...


Information for package Mesa-libGL1:
------------------------------------
Repository: Main Update Repository
Name: Mesa-libGL1
Version: 9.2.5-61.13.1
Arch: x86_64
Vendor: openSUSE
Installed: Yes
Status: up-to-date
Installed Size: 376.0 KiB
Summary: The GL/GLX runtime of the Mesa 3D graphics library
Description: 
Mesa is a software library for 3D computer graphics that provides a
generic OpenGL implementation for rendering three-dimensional
graphics.

GLX ("OpenGL Extension to the X Window System") provides the
interface connecting OpenGL and the X Window System: it enables
programs wishing to use OpenGL to do so within a window provided by
the X Window System.

Build commands used for OpenArena, bzflag and Red Eclipse:

sven@linux-etoq:~/projects/nixpkgs/test/openarena> nix-build ../../ -A openarena
sven@linux-etoq:~/projects/nixpkgs/test/bzflag> nix-build ../../ -A bzflag
sven@linux-etoq:~/projects/nixpkgs/test> nix-build ../../ -A redeclipse

Red Eclipse is a package I'm working on, it is not currently in nixpkgs. The package in its current state:

{ fetchurl, stdenv, SDL, SDL_image, SDL_mixer, zlib, ed }:

let
  mods = {
    base = "94b0475c7c161d4fdb59a9ebe0d740ec07b1934abf348d78d4f127f369d912f8";
    acerspyro = "18718286a72298b0a016d147524bc53094c4ad3897859ec8422131b5acc9bd3f";
    actors = "34825b5bb7f79bf9518e5e48f01ecb720cc559bb969575b93da05b5305c209cb";
    appleflap = "05c5aae92779ef8b6feb74ee396d27001aa8692610c35b33421419dd0d0bc4b2";
    blendbrush = "c0fb3257fd4a9b425bfa015ff0126807af85dbada89223765689e618ad7d4b72";
    caustics = "25b0366b0e434049d382fdeda0b62e38a7fdadf398d714713d829908f10dbb3f";
    crosshairs = "732e0a874ad39d4ee329e4b82badd8e3b513ad4a5a6f7ea5c5c2d30a42839e6e";
    elyvisions = "29d8554151789578cbce17718d911c36e3453ee3b700b96b4ca0b9d4f2391468";
    fonts = "b88246a3a194afd0e3928d447d9e49c8869ce157c005dca2ad7610479344f62a";
    freezurbern = "9669ca25a3cdffaf6172829a1e04dad51f43bf4bd98b794d1574a18dded0c078";
    john = "8d02259d0878b91c2c16b8c323f2bbf8fba521a5694f9bb160ca5f7c32b0bcd2";
    jojo = "a97b45a1e095c11f1b9b5c34ed2f28e6427a784c56fc0a143288638a59cc036a";
    jwin = "539873a19cbafd10499959619199791ebc6feabcde20c4db1e9298dea14c85e4";
    luckystrike = "21516564ba832507ecb93f05d03e662bd4dc0944d7bc800bc1127c96d941b823";
    maps = "71a79ec665e99268637952bd883afcda02345c9944494822fe96b45511c410b8";
    mayhem = "95a9ce7bfa8bc4e38da8197ef85e530e312ba040cf772bae99e84745cc95c9c2";
    mikeplus64 = "57a92abff536d459e413d424e8a948c2951a7f476dbb00831bf54ddfedff42ce";
    misc = "aec506cf659452a717430fe6104e0624eac5bd59f22c64ca5033d65cb4fc15de";
    nobiax = "159e98527ea953e1af8f49808ad61f34d08189b720e070463ff88a4a044b3622";
    particles = "759b46e2d8edc2ac893dd8fce8820b208789d9bc2c63679db35366b88d1e8d71";
    philipk = "ea4daa2e02c13bbb8d0ba18ad7d3dfdc0f39355dccc36c556bbaec88aeaa13e8";
    projectiles = "d2beb17e7b7928718d5c4d9697238027523ddd6a2f168d900b8d599d93ceb075";
    props = "79f474367f808faa7293e73851e0331a354760db0dd0b8d061f1d74b921a70e9";
    skyboxes = "f17df31c857abd7106159e82ba92b252db8ce68df21a893023d3017d8d2ac943";
    sounds = "ebcc960b5e3ecee80e04aec8335554ffdb36ecc030791666903a85cad469dede";
    textures = "a59c604d134bf0e82d31340878c4790060dc82f7a4417ada1d7782da09b3ae3f";
    torley = "4607d60be7080b0ac5c6ef801f158d2ba6e79982e9861eecdd15698a5c2d31b3";
    trak = "78e9bb131fe144b516ce29be6c9f64f2991731e49935576caa3ed999ca2fd377";
    ulukai = "638fb7ac0e0d8eb1f13c7a01d00d31ce7844c06d8907ad2a20ea571b094b3b7e";
    unnamed = "bd7da14d9e715d6dcc2687921f668739d0ba45a9f01350c1b5347e956648a242";
    vanities = "bcd9a0f22314c0bb98fc193f18f04a3cc9f1aa6b83c70a02de34b779cc166ce1";
    vegetation = "c076f3f50caac5bec5889fc8e11028882b7a39cee8560684918c3a0eb847228d";
    weapons = "23d70fb68fe34ba9c952f74b2ec6ca30b9dda8664248db10f5b434cb9c3516be";
    wicked = "0fc5a75c6b0a2a9c90a664e2b9ec958928b3059f03e90228cca547f376532b61";
  };

  createModItem = version: modName: {
    name = modName;
    value = fetchurl {
      name = "${modName}-${version}.tar.gz";
      url = "https://github.com/red-eclipse/${modName}/archive/v${version}.tar.gz";
      sha256 = builtins.getAttr modName mods;
    };
  };

  makeModList = version:
    let
      modNames = builtins.attrNames mods;
      modList = builtins.map
        (createModItem version)
        modNames;
    in
      builtins.listToAttrs modList;

  sources = version: makeModList version;
in
  stdenv.mkDerivation rec {
    name = "red-eclipse-${version}";
    version = "1.5.3";

    sourceRoot = "base-${version}";

    srcs = builtins.attrValues (sources version);

    buildInputs = [SDL SDL_image SDL_mixer zlib ed];

    preBuild = ''
      for i in \
        acerspyro actors appleflap blendbrush caustics crosshairs elyvisions \
        fonts freezurbern john jojo jwin luckystrike maps mayhem mikeplus64 misc \
        nobiax particles philipk projectiles props skyboxes sounds textures \
        torley trak ulukai unnamed vanities vegetation weapons wicked
      do
        rmdir "data/$i"
        mv "../$i-${version}" "data/$i"
      done
    '';

    buildPhase = ''
      runHook preBuild;
      make ''${enableParallelBuilding:+-j''${NIX_BUILD_CORES} -l''${NIX_BUILD_CORES}} -C src/ prefix=$out system-install
    '';

    installPhase = ''

    '';
  }

Both bzflag and Red Eclipse fail in the same way:

sven@linux-etoq:~/projects/nixpkgs/test/bzflag> LD_LIBRARY_PATH=~/libgl-shim/ result/bin/bzflag 
Segmentation fault
sven@linux-etoq:~/projects/nixpkgs/test> LD_LIBRARY_PATH=~/libgl-shim/ result/bin/redeclipse
Segmentation fault

The LD_LIBRARY_PATH is using this method of linking against the system-native libGL, rather than using the Nix-packaged one (as this is a non-NixOS system).

However, upon discovering that the regular libGL on my system is actually not in /usr/lib64 but rather in an fglrx-specific directory (and using the one in /usr/lib64 would only give access to swrast), I wrote a find-lib-gl.sh as follows:

ldd `which glxinfo` | grep libGL | sed -r 's/.+libGL\.so\.1 => (.+) \(.+/\1/m'

Which in my case outputs:

sven@linux-etoq:~/projects/nixpkgs/test> ~/find-libgl.sh 
/usr/X11R6/lib64/libGL.so.1

... and I copied and patched that file into my shim directory, instead of /usr/lib64/libGL.so.1.

OpenArena does work with my newly patched libGL, but bzflag and Red Eclipse do not. It's not clear to me where the difference is.

gdb output for Red Eclipse (running from result/lib/redeclipse directly, because of how Red Eclipse looks for its data and configuration files):

sven@linux-etoq:~/projects/nixpkgs/test/result/lib/redeclipse> LD_LIBRARY_PATH=~/libgl-shim/ gdb redeclipse
GNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
..
Reading symbols from /nix/store/wbiq5zzdzc0d2j3y6g0yfy06qbi0i8lw-red-eclipse-1.5.3/lib/redeclipse/redeclipse...(no debugging symbols found)...done.
(gdb) run
Starting program: /nix/store/wbiq5zzdzc0d2j3y6g0yfy06qbi0i8lw-red-eclipse-1.5.3/lib/redeclipse/redeclipse 
warning: File "/nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libthread_db-1.0.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
    add-auto-load-safe-path /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libthread_db-1.0.so
line to your configuration file "/home/sven/.gdbinit".
To completely disable this security protection add
    set auto-load safe-path /
line to your configuration file "/home/sven/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
    info "(gdb)Auto-loading safe path"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
Missing separate debuginfo for /home/sven/libgl-shim/libGL.so.1
warning: File "/nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6.0.20-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
Missing separate debuginfo for /usr/X11R6/lib64/modules/dri/fglrx_dri.so
Missing separate debuginfo for /usr/lib64/libXinerama.so.1
Try: zypper install -C "debuginfo(build-id)=1e4fd16b4219872ba01206ff9d4fb163aae72d00"

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff09241a7 in ?? () from /usr/X11R6/lib64/modules/dri/fglrx_dri.so

The linking (through the shim) does appear to work correctly. Here is the ldd output, using the Nix-provided ldd, and taking into account the environment that is set up by the wrapper script(s).

OpenArena:

sven@linux-etoq:~/projects/nixpkgs/test> LD_LIBRARY_PATH=~/libgl-shim/ LD_LIBRARY_PATH=/nix/store/y9mdjaxnlyqca3c27iri7nvnn7xlk1yh-SDL-1.2.15/lib:/nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib:/nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd /nix/store/qnssnin0hayb4vfanq0nlm5wwnbvcrz5-openarena-0.8.8/openarena-0.8.8/openarena.x86_64
    linux-vdso.so.1 (0x00007ffd81ef0000)
    libSDL-1.2.so.0 => /nix/store/y9mdjaxnlyqca3c27iri7nvnn7xlk1yh-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007fc861be8000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007fc8619d8000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007fc8617c8000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007fc861590000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007fc861388000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007fc861180000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007fc860f78000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007fc860c70000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007fc8608d0000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007fc8605a8000)
    libpulse-simple.so.0 => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007fc8603a0000)
    libpulse.so.0 => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007fc860150000)
    libpulsecommon-6.0.so => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007fc85fed0000)
    libjson-c.so.2 => /nix/store/2jmm5hdpmfirdl80jyiakvjlilp6gldv-json-c-0.12/lib/libjson-c.so.2 (0x00007fc85fcc0000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007fc85fa58000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007fc85f7e0000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007fc85f528000)
    libdbus-1.so.3 => /nix/store/byb21384hrw1fsh9rzzrvkq3bmm0dlv8-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007fc85f2e0000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007fc85f0d8000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007fc85ed98000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007fc85eb80000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007fc85e970000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007fc85e760000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007fc85e540000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007fc861e80000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007fc85e338000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007fc85e118000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007fc85df10000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007fc85dd08000)

Red Eclipse:

sven@linux-etoq:~/projects/nixpkgs/test> LD_LIBRARY_PATH=~/libgl-shim/ /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd result/lib/redeclipse/redeclipse
    linux-vdso.so.1 (0x00007ffc856f0000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007fc0bf7d0000)
    libSDL-1.2.so.0 => /nix/store/9sy7rrin9rd4j83mjwmgwc179s81miqg-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007fc0bf538000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007fc0bf318000)
    libSDL_image-1.2.so.0 => /nix/store/rzd2mf38xlwscky57mj5pbpgqk05viyh-SDL_image-1.2.12/lib/libSDL_image-1.2.so.0 (0x00007fc0bf0f8000)
    libSDL_mixer-1.2.so.0 => /nix/store/j7i02c53qcwbdlzj9rhc8314j2b2ah5h-SDL_mixer-1.2.12/lib/libSDL_mixer-1.2.so.0 (0x00007fc0beea8000)
    libz.so.1 => /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib/libz.so.1 (0x00007fc0bec90000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007fc0bea80000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007fc0be878000)
    libstdc++.so.6 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6 (0x00007fc0be568000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007fc0be260000)
    libgcc_s.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libgcc_s.so.1 (0x00007fc0be048000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007fc0bdca8000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007fc0bda88000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007fc0bd880000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007fc0bd678000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007fc0bd470000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007fc0bd148000)
    libpulse-simple.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007fc0bcf40000)
    libpulse.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007fc0bccf0000)
    libpulsecommon-6.0.so => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007fc0bca70000)
    libjson-c.so.2 => /nix/store/jaklgzhv2qcq9h71w95sw0c49dbrqc7r-json-c-0.12/lib/libjson-c.so.2 (0x00007fc0bc860000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007fc0bc5f8000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007fc0bc380000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007fc0bc0c8000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007fc0bbe90000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007fc0bbc88000)
    libdbus-1.so.3 => /nix/store/s42mk8l35nh0p3li6qq9gmpmq37dh7qf-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007fc0bba40000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007fc0bb838000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007fc0bb620000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007fc0bb410000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007fc0bb200000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007fc0bfb10000)
    libpng16.so.16 => /nix/store/kxrznj68yq3ph6m2wc1vbxh4qw6ql2f2-libpng-apng-1.6.18/lib/libpng16.so.16 (0x00007fc0bafc8000)
    libjpeg.so.62 => /nix/store/pfgx11m6kr910i2xrs3679faz3v67plf-libjpeg-turbo-1.4.1/lib/libjpeg.so.62 (0x00007fc0bad60000)
    libtiff.so.5 => /nix/store/pgs7icihncbf27n1jvlb30zbxwf7q5zc-libtiff-4.0.4beta/lib/libtiff.so.5 (0x00007fc0baae8000)
    libfluidsynth.so.1 => /nix/store/sjx30jsbj84slvc6lp9riary46llqmfl-fluidsynth-1.1.6/lib/libfluidsynth.so.1 (0x00007fc0ba818000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007fc0ba608000)
    libsmpeg-0.4.so.0 => /nix/store/1rf3z0498vinjw4jjk4rx6fvnq55ahgm-smpeg-svn390/lib/libsmpeg-0.4.so.0 (0x00007fc0ba3a8000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007fc0ba1a0000)
    liblzma.so.5 => /nix/store/ivp3pna40wrq4i2whp4ijksfi4b8z58k-xz-5.2.1/lib/liblzma.so.5 (0x00007fc0b9f78000)
    libjack.so.0 => /nix/store/rhrj3y0nvxk0699jnrlfx30sh92nnxfc-libjack2-2015-06-02/lib/libjack.so.0 (0x00007fc0b9d18000)
    libgthread-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libgthread-2.0.so.0 (0x00007fc0b9b10000)
    libglib-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libglib-2.0.so.0 (0x00007fc0b97d8000)
    libopus.so.0 => /nix/store/984qsrday6gg7fv7m9r7dg8dv7x2fsxs-libopus-1.1/lib/libopus.so.0 (0x00007fc0b9588000)

bzflag:

sven@linux-etoq:~/projects/nixpkgs/test/bzflag> LD_LIBRARY_PATH=~/libgl-shim/ /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd result/bin/bzflag               
    linux-vdso.so.1 (0x00007ffda8b58000)
    libSDL-1.2.so.0 => /nix/store/y9mdjaxnlyqca3c27iri7nvnn7xlk1yh-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007f4ebd8b0000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007f4ebd588000)
    libpulse-simple.so.0 => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007f4ebd380000)
    libpulse.so.0 => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007f4ebd130000)
    libpulsecommon-6.0.so => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007f4ebceb0000)
    libjson-c.so.2 => /nix/store/2jmm5hdpmfirdl80jyiakvjlilp6gldv-json-c-0.12/lib/libjson-c.so.2 (0x00007f4ebcca0000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007f4ebca38000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007f4ebc7c0000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007f4ebc508000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007f4ebc2d0000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007f4ebc0c8000)
    libdbus-1.so.3 => /nix/store/byb21384hrw1fsh9rzzrvkq3bmm0dlv8-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007f4ebbe80000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007f4ebbc78000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007f4ebba70000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007f4ebb868000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007f4ebb658000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007f4ebb448000)
    libGLU.so.1 => /nix/store/ldp4bm03b9vkmymzpvgqas1p0k58icqz-mesa-10.6.5/lib/libGLU.so.1 (0x00007f4ebb1c8000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007f4ebafb8000)
    libXxf86vm.so.1 => /nix/store/2vi8ac37awm4jscxavg8nf1p03w6ph0v-libXxf86vm-1.1.4/lib/libXxf86vm.so.1 (0x00007f4ebadb0000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007f4ebab98000)
    libSM.so.6 => /nix/store/64azqpprhmq7k4c2m877jxq5cjgq5x9g-libSM-1.2.2/lib/libSM.so.6 (0x00007f4eba990000)
    libICE.so.6 => /nix/store/dkajwpq9mmiznq16gf38n4mqiirysvfc-libICE-1.0.9/lib/libICE.so.6 (0x00007f4eba770000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007f4eba430000)
    libGLEW.so.1.11 => /nix/store/nbpis3hi1djqhc6yxrhm3l2ay2x044cj-glew-1.11.0/lib/libGLEW.so.1.11 (0x00007f4eba198000)
    libcurl.so.4 => /nix/store/fwh3ygh58ds40kbd9jiyp4rcrvi0zw9n-curl-7.43.0/lib/libcurl.so.4 (0x00007f4eb9f28000)
    libssh2.so.1 => /nix/store/xb60as50jw9617ikkl9jkva2x6i8jawa-libssh2-1.6.0/lib/libssh2.so.1 (0x00007f4eb9cf8000)
    libssl.so.1.0.0 => /nix/store/myvm6vrbckar8id33iy1gfzsv7p870zi-openssl-1.0.1p/lib/libssl.so.1.0.0 (0x00007f4eb9a88000)
    libcrypto.so.1.0.0 => /nix/store/myvm6vrbckar8id33iy1gfzsv7p870zi-openssl-1.0.1p/lib/libcrypto.so.1.0.0 (0x00007f4eb9698000)
    libz.so.1 => /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib/libz.so.1 (0x00007f4eb9480000)
    libstdc++.so.6 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/../lib64/libstdc++.so.6 (0x00007f4eb9170000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007f4eb8f50000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007f4eb8c48000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007f4eb88a8000)
    libgcc_s.so.1 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/../lib64/libgcc_s.so.1 (0x00007f4eb8690000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007f4ebdb48000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007f4eb8488000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007f4eb8268000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007f4eb8060000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007f4eb7e58000)
    libexpat.so.1 => /nix/store/6vrrwl9cp39rvp324nnb05iacbzn732z-expat-2.1.0/lib/libexpat.so.1 (0x00007f4eb7c28000)
    libglapi.so.0 => /nix/store/dh0zljw6r71m91cq20pch4wrpffzf94v-mesa-noglu-10.6.5/lib/libglapi.so.0 (0x00007f4eb79f8000)
    libXdamage.so.1 => /nix/store/4ms2h0yd7rw1yb9pa00f5s4zp68qay1p-libXdamage-1.1.4/lib/libXdamage.so.1 (0x00007f4eb77f0000)
    libXfixes.so.3 => /nix/store/5n8b9dg83xrgn35wfbn9hzy9j1q56sps-libXfixes-5.0.1/lib/libXfixes.so.3 (0x00007f4eb75e8000)
    libX11-xcb.so.1 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11-xcb.so.1 (0x00007f4eb73e0000)
    libxcb-glx.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-glx.so.0 (0x00007f4eb71c8000)
    libxcb-dri2.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-dri2.so.0 (0x00007f4eb6fc0000)
    libxcb-dri3.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-dri3.so.0 (0x00007f4eb6db8000)
    libxcb-present.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-present.so.0 (0x00007f4eb6bb0000)
    libxcb-randr.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-randr.so.0 (0x00007f4eb69a0000)
    libxcb-xfixes.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-xfixes.so.0 (0x00007f4eb6798000)
    libxcb-render.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-render.so.0 (0x00007f4eb6588000)
    libxcb-shape.so.0 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-shape.so.0 (0x00007f4eb6380000)
    libxcb-sync.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb-sync.so.1 (0x00007f4eb6178000)
    libxshmfence.so.1 => /nix/store/crcnkjlavdrvapw8wqrd6kqzwbay60xv-libxshmfence-1.2/lib/libxshmfence.so.1 (0x00007f4eb5f70000)
    libdrm.so.2 => /nix/store/j00x1sblqvnq0vpii6kcxnj89lz2armf-libdrm-2.4.64/lib/libdrm.so.2 (0x00007f4eb5d60000)
    libuuid.so.1 => /nix/store/nzq4igi8ls5pszvzy96jq1h23shyqdrj-util-linux-2.26.2/lib/libuuid.so.1 (0x00007f4eb5b58000)

CCing @vcunat on this, as suggested by @ttuegel.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

OpenArena does work with my newly patched libGL, but bzflag and Red Eclipse do not. It's not clear to me where the difference is.

The difference is that OpenArena is compiled by the upstream project, but bzflag is compiled by Nixpkgs.

@vcunat I thought we should ping you on this because of the Mesa issue. It looks like the Nixpkgs Mesa's libGL is incompatible with proprietary drivers on non-NixOS systems. I think there must be a way to resolve this because it works on NixOS and the OpenArena upstream folks seem to have compiled a cross-system executable somehow, but I really don't know anything about Mesa.

@vcunat
Copy link
Member

vcunat commented Sep 13, 2015

I believe that system libGL should load system libs for its own use, not our libs (therefore I believe your approach is wrong). The libGL itself has a fairly stable ABI – that's why games distributed in binary form do work over a wide range of GL versions and vendors.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

@vcunat We were patchelf-ing the host system's libGL so it would load everything from the host system, I don't know what happened.

@joepie91 From that ldd output, it looks like you didn't patchelf the ATI driver.

@joepie91
Copy link
Contributor Author

@ttuegel I don't know very much about what ldd output is supposed to look like. What should it look like when things are patched correctly, and does anything need patching beyond libGL.so.1?

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

@joepie91 If you run ldd libGL.so.1 (on the ATI libGL, with your host ldd), it will list all of libGL's dependencies and the host libraries that fill them. Then, if you run ldd redeclipse (with Nix's ldd and the LD_LIBRARY_PATH set), every library in common with ldd libGL.so.1 should come from the host system.

@joepie91
Copy link
Contributor Author

Doesn't look like the patchelf works here:

sven@linux-etoq:~/projects/nixpkgs/test> ldd ~/libgl-shim/libGL.so.1 | sort
    /lib64/ld-linux-x86-64.so.2 (0x00007f5ab9700000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f5ab8998000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f5ab8368000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f5ab90b8000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f5ab8d08000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f5ab8570000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5ab92d0000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f5ab8778000)
    linux-vdso.so.1 (0x00007fff907d8000)
sven@linux-etoq:~/projects/nixpkgs/test> LD_LIBRARY_PATH=~/libgl-shim/ /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd result/lib/redeclipse/redeclipse | sort
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007fb11f570000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007fb11bde0000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007fb11e4e0000)
    libSDL-1.2.so.0 => /nix/store/9sy7rrin9rd4j83mjwmgwc179s81miqg-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007fb11ef98000)
    libSDL_image-1.2.so.0 => /nix/store/rzd2mf38xlwscky57mj5pbpgqk05viyh-SDL_image-1.2.12/lib/libSDL_image-1.2.so.0 (0x00007fb11eb58000)
    libSDL_mixer-1.2.so.0 => /nix/store/j7i02c53qcwbdlzj9rhc8314j2b2ah5h-SDL_mixer-1.2.12/lib/libSDL_mixer-1.2.so.0 (0x00007fb11e908000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007fb11f230000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007fb11d2e0000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007fb11d0d8000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007fb11b080000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007fb11ae70000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007fb11ac60000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007fb11cba8000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007fb119c00000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007fb11d708000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007fb11b298000)
    libdbus-1.so.3 => /nix/store/s42mk8l35nh0p3li6qq9gmpmq37dh7qf-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007fb11b4a0000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007fb11ced0000)
    libfluidsynth.so.1 => /nix/store/sjx30jsbj84slvc6lp9riary46llqmfl-fluidsynth-1.1.6/lib/libfluidsynth.so.1 (0x00007fb11a278000)
    libgcc_s.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libgcc_s.so.1 (0x00007fb11daa8000)
    libglib-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libglib-2.0.so.0 (0x00007fb119238000)
    libgthread-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libgthread-2.0.so.0 (0x00007fb119570000)
    libjack.so.0 => /nix/store/rhrj3y0nvxk0699jnrlfx30sh92nnxfc-libjack2-2015-06-02/lib/libjack.so.0 (0x00007fb119778000)
    libjpeg.so.62 => /nix/store/pfgx11m6kr910i2xrs3679faz3v67plf-libjpeg-turbo-1.4.1/lib/libjpeg.so.62 (0x00007fb11a7c0000)
    libjson-c.so.2 => /nix/store/jaklgzhv2qcq9h71w95sw0c49dbrqc7r-json-c-0.12/lib/libjson-c.so.2 (0x00007fb11c2c0000)
    liblzma.so.5 => /nix/store/ivp3pna40wrq4i2whp4ijksfi4b8z58k-xz-5.2.1/lib/liblzma.so.5 (0x00007fb1199d8000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007fb11dcc0000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007fb11b6e8000)
    libopus.so.0 => /nix/store/984qsrday6gg7fv7m9r7dg8dv7x2fsxs-libopus-1.1/lib/libopus.so.0 (0x00007fb118fe8000)
    libpng16.so.16 => /nix/store/kxrznj68yq3ph6m2wc1vbxh4qw6ql2f2-libpng-apng-1.6.18/lib/libpng16.so.16 (0x00007fb11aa28000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007fb11ed78000)
    libpulse-simple.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007fb11c9a0000)
    libpulse.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007fb11c750000)
    libpulsecommon-6.0.so => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007fb11c4d0000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007fb11e2d8000)
    libsmpeg-0.4.so.0 => /nix/store/1rf3z0498vinjw4jjk4rx6fvnq55ahgm-smpeg-svn390/lib/libsmpeg-0.4.so.0 (0x00007fb119e08000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007fb11c058000)
    libstdc++.so.6 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6 (0x00007fb11dfc8000)
    libtiff.so.5 => /nix/store/pgs7icihncbf27n1jvlb30zbxwf7q5zc-libtiff-4.0.4beta/lib/libtiff.so.5 (0x00007fb11a548000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007fb11b8f0000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007fb11bb28000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007fb11a068000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007fb11d4e8000)
    libz.so.1 => /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib/libz.so.1 (0x00007fb11e6f0000)
    linux-vdso.so.1 (0x00007ffc9a588000)
sven@linux-etoq:~/projects/nixpkgs/test> patchelf --set-rpath /lib:/usr/lib:/lib64:/usr/lib64 ~/libgl-shim/libGL.so.1 
sven@linux-etoq:~/projects/nixpkgs/test> ldd ~/libgl-shim/libGL.so.1 | sort
    /lib64/ld-linux-x86-64.so.2 (0x00007f008db90000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f008ce28000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f008c7f8000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f008d548000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f008d198000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f008ca00000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f008d760000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f008cc08000)
    linux-vdso.so.1 (0x00007ffc83de8000)
sven@linux-etoq:~/projects/nixpkgs/test> LD_LIBRARY_PATH=~/libgl-shim/ /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd result/lib/redeclipse/redeclipse | sort
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007faea4388000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007faea0bf8000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007faea32f8000)
    libSDL-1.2.so.0 => /nix/store/9sy7rrin9rd4j83mjwmgwc179s81miqg-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007faea3db0000)
    libSDL_image-1.2.so.0 => /nix/store/rzd2mf38xlwscky57mj5pbpgqk05viyh-SDL_image-1.2.12/lib/libSDL_image-1.2.so.0 (0x00007faea3970000)
    libSDL_mixer-1.2.so.0 => /nix/store/j7i02c53qcwbdlzj9rhc8314j2b2ah5h-SDL_mixer-1.2.12/lib/libSDL_mixer-1.2.so.0 (0x00007faea3720000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007faea4048000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007faea20f8000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007faea1ef0000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007fae9fe98000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007fae9fc88000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007fae9fa78000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007faea19c0000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007fae9ea18000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007faea2520000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007faea00b0000)
    libdbus-1.so.3 => /nix/store/s42mk8l35nh0p3li6qq9gmpmq37dh7qf-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007faea02b8000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007faea1ce8000)
    libfluidsynth.so.1 => /nix/store/sjx30jsbj84slvc6lp9riary46llqmfl-fluidsynth-1.1.6/lib/libfluidsynth.so.1 (0x00007fae9f090000)
    libgcc_s.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libgcc_s.so.1 (0x00007faea28c0000)
    libglib-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libglib-2.0.so.0 (0x00007fae9e050000)
    libgthread-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libgthread-2.0.so.0 (0x00007fae9e388000)
    libjack.so.0 => /nix/store/rhrj3y0nvxk0699jnrlfx30sh92nnxfc-libjack2-2015-06-02/lib/libjack.so.0 (0x00007fae9e590000)
    libjpeg.so.62 => /nix/store/pfgx11m6kr910i2xrs3679faz3v67plf-libjpeg-turbo-1.4.1/lib/libjpeg.so.62 (0x00007fae9f5d8000)
    libjson-c.so.2 => /nix/store/jaklgzhv2qcq9h71w95sw0c49dbrqc7r-json-c-0.12/lib/libjson-c.so.2 (0x00007faea10d8000)
    liblzma.so.5 => /nix/store/ivp3pna40wrq4i2whp4ijksfi4b8z58k-xz-5.2.1/lib/liblzma.so.5 (0x00007fae9e7f0000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007faea2ad8000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007faea0500000)
    libopus.so.0 => /nix/store/984qsrday6gg7fv7m9r7dg8dv7x2fsxs-libopus-1.1/lib/libopus.so.0 (0x00007fae9de00000)
    libpng16.so.16 => /nix/store/kxrznj68yq3ph6m2wc1vbxh4qw6ql2f2-libpng-apng-1.6.18/lib/libpng16.so.16 (0x00007fae9f840000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007faea3b90000)
    libpulse-simple.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007faea17b8000)
    libpulse.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007faea1568000)
    libpulsecommon-6.0.so => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007faea12e8000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007faea30f0000)
    libsmpeg-0.4.so.0 => /nix/store/1rf3z0498vinjw4jjk4rx6fvnq55ahgm-smpeg-svn390/lib/libsmpeg-0.4.so.0 (0x00007fae9ec20000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007faea0e70000)
    libstdc++.so.6 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6 (0x00007faea2de0000)
    libtiff.so.5 => /nix/store/pgs7icihncbf27n1jvlb30zbxwf7q5zc-libtiff-4.0.4beta/lib/libtiff.so.5 (0x00007fae9f360000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007faea0708000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007faea0940000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007fae9ee80000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007faea2300000)
    libz.so.1 => /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib/libz.so.1 (0x00007faea3508000)
    linux-vdso.so.1 (0x00007fffca900000)

It doesn't look much better for OpenArena, when adding the wrapper script variables:

sven@linux-etoq:~/projects/nixpkgs/test> LD_LIBRARY_PATH=~/libgl-shim/ LD_LIBRARY_PATH=/nix/store/y9mdjaxnlyqca3c27iri7nvnn7xlk1yh-SDL-1.2.15/lib:/nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib:/nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd openarena/result/openarena-0.8.8/openarena.x86_64 | sort
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007fc1e6350000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007fc1e3cb0000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007fc1e5ea8000)
    libSDL-1.2.so.0 => /nix/store/y9mdjaxnlyqca3c27iri7nvnn7xlk1yh-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007fc1e60b8000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007fc1e3268000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007fc1e23e0000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007fc1e21d8000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007fc1e3050000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007fc1e2e40000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007fc1e2c30000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007fc1e4a78000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007fc1e2808000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007fc1e4da0000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007fc1e35a8000)
    libdbus-1.so.3 => /nix/store/byb21384hrw1fsh9rzzrvkq3bmm0dlv8-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007fc1e37b0000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007fc1e5448000)
    libjson-c.so.2 => /nix/store/2jmm5hdpmfirdl80jyiakvjlilp6gldv-json-c-0.12/lib/libjson-c.so.2 (0x00007fc1e4190000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007fc1e5140000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007fc1e5858000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007fc1e2a10000)
    libpulse-simple.so.0 => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007fc1e4870000)
    libpulse.so.0 => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007fc1e4620000)
    libpulsecommon-6.0.so => /nix/store/qklab0a6cs5bhvf0iv88szg5pwbjypbg-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007fc1e43a0000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007fc1e5650000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007fc1e3f28000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007fc1e5a60000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007fc1e39f8000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007fc1e5c98000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007fc1e25e8000)
    linux-vdso.so.1 (0x00007ffde6bf0000)

One thing I realized for OpenArena, taking into account its wrapper script (displaying the LD_LIBRARY_PATH):

sven@linux-etoq:~/projects/nixpkgs/test> LD_LIBRARY_PATH=~/libgl-shim/ LD_LIBRARY_PATH=/nix/store/y9mdjaxnlyqca3c27iri7nvnn7xlk1yh-SDL-1.2.15/lib:/nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib:/nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH ~/show-path.sh       
/nix/store/y9mdjaxnlyqca3c27iri7nvnn7xlk1yh-SDL-1.2.15/lib:/nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib:/nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib:/home/sven/libgl-shim/

I'm not sure whether that's right.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

I believe that system libGL should load system libs for its own use, not our libs (therefore I believe your approach is wrong).

@vcunat How can we make that happen? The Nix ld.so does not look in the default system paths, and the host libGL doesn't have any RPATHs set. I thought we could patchelf the system libGL to add the default system paths, but that doesn't help (as indicated above). If we set LD_LIBRARY_PATH to the default system paths, then all the dependencies will come from the host system, not just libGL's dependencies.

@vcunat
Copy link
Member

vcunat commented Sep 13, 2015

I'm sorry, I confused your intentions.

@joepie91: make sure you're using ldd from nix, because the host one has different rules for loading libraries. Also, the value of patchelf --print-interpreter should be from nix's libc.

@joepie91
Copy link
Contributor Author

Hmm. Using Nix' ldd on the patched libGL:

sven@linux-etoq:~/projects/nixpkgs/test> /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ~/libgl-shim/libGL.so.1 | sort
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib64/ld-linux-x86-64.so.2 (0x00007f9b6ed18000)
    libX11.so.6 => not found
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f9b6e6d0000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f9b6e320000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9b6e8e8000)
    linux-vdso.so.1 (0x00007ffd64948000)

And --print-interpreter:

sven@linux-etoq:~/projects/nixpkgs/test> patchelf --print-interpreter ~/libgl-shim/libGL.so.1 
cannot find section .interp

@vcunat
Copy link
Member

vcunat commented Sep 13, 2015

So, likely we need to add patchelf --set-interpreter /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux.so.2 (check that the file exists) to make sure that ld from nix is used. In nix packages at least we always do that.

I'm still not completely certain that what we aim for is the best way, but currently I can't directly see a better one.

@joepie91
Copy link
Contributor Author

Hm. It doesn't seem to work, even with a 'clean' copy of libGL:

sven@linux-etoq:~/projects/nixpkgs/test> patchelf --set-interpreter /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 ~/libgl-shim/libGL.so.1 
cannot find section .interp

(I checked the ld-linux path, the one that is used above exists.)

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

So, likely we need to add patchelf --set-interpreter /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux.so.2 (check that the file exists) to make sure that ld from nix is used. In nix packages at least we always do that.

Shared libraries don't have interpreters, only executables. The executable in this case was compiled by Nixpkgs.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

libX11.so.6 => not found

@joepie91 This is almost certainly (part) of the problem. Can you check where the unmodified libGL gets libX11 from? That path will need to be added to the RPATH of the modified libGL.

@joepie91
Copy link
Contributor Author

That would be, for host ldd and Nix ldd respectively:

sven@linux-etoq:~/redeclipse-1.5.3> ldd `~/find-libgl.sh` | sort
    /lib64/ld-linux-x86-64.so.2 (0x00007f7ae5530000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f7ae47d8000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f7ae41a8000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f7ae4ec8000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f7ae4b18000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f7ae43b0000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7ae50e0000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f7ae45b8000)
    linux-vdso.so.1 (0x00007ffd259c8000)
sven@linux-etoq:~/redeclipse-1.5.3> /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd `~/find-libgl.sh` | sort
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib64/ld-linux-x86-64.so.2 (0x00007ff59f1f8000)
    libXext.so.6 => not found
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007ff59ea38000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007ff59edd8000)
    linux-vdso.so.1 (0x00007ffc0c318000)

... so, that doesn't really tell us much more...

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

@joepie91 Huh? That can't be right, the list of required libraries must at least be the same, regardless of what linker you use!

@joepie91
Copy link
Contributor Author

Perhaps libX11.so.6 isn't in the list because libXext.so.6 failed, and that's where the dependency comes from? I have no idea, you know more about this than I do :)

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

@joepie91 Oh, nevermind, it's because Nix's ldd can't find libXext. (In the future, please do not pipe the output of ldd through sort because the order is important.) What command are you using to make the patched libGL?

@joepie91
Copy link
Contributor Author

Ah, I see. The command I used was:

patchelf --set-rpath /lib:/usr/lib:/lib64:/usr/lib64 ~/libgl-shim/libGL.so.1

Here's the previous output, without sort:

sven@linux-etoq:~/redeclipse-1.5.3> ldd `~/find-libgl.sh`       
    linux-vdso.so.1 (0x00007ffc86938000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f217b290000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f217b078000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f217acc8000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f217b6e0000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f217a988000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f217a768000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f217a560000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f217a358000)
sven@linux-etoq:~/redeclipse-1.5.3> /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd `~/find-libgl.sh`       
    linux-vdso.so.1 (0x00007ffea3780000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007f5b60208000)
    libXext.so.6 => not found
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007f5b5fe68000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib64/ld-linux-x86-64.so.2 (0x00007f5b60628000)

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

OK, something doesn't add up here. You patched libGL with

patchelf --set-rpath /lib:/usr/lib:/lib64:/usr/lib64 ~/libgl-shim/libGL.so.1

But when you run Nix ldd on the patched libGL, it can't find libX11. Yet, your system ldd finds libX11 in /usr/lib64:

libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f217a988000)

What happens if you run you system ldd on the patched libGL?

@joepie91
Copy link
Contributor Author

sven@linux-etoq:~/redeclipse-1.5.3> ldd ~/libgl-shim/libGL.so.1 
    linux-vdso.so.1 (0x00007ffe833c0000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f23d95f8000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f23d93e0000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f23d9030000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f23d9a28000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f23d8cc0000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f23d8aa0000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f23d8898000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f23d8690000)

And I just verified that the Nix ldd really still isn't finding it:

sven@linux-etoq:~/redeclipse-1.5.3> /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ~/libgl-shim/libGL.so.1 
    linux-vdso.so.1 (0x00007ffe45df0000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1658900000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f16586e8000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f1658338000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib64/ld-linux-x86-64.so.2 (0x00007f1658d30000)
    libX11.so.6 => not found

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

Oh! I understand now. The modified RPATH of libGL doesn't affect the search path for libX11, because it's not a direct dependency; it's only a dependency of libXext, which we have not modified. Let's try adding an explicit dependency on libX11 to libGL:

patchelf --add-needed libX11.so.6 libGL.so.1

If that doesn't work, we'll likely need to add a patchelf'd version of libXext.

@joepie91
Copy link
Contributor Author

sven@linux-etoq:~/libgl-shim> patchelf --add-needed libX11.so.6 libGL.so.1
stat: No such file or directory
sven@linux-etoq:~/libgl-shim> ls
libGL.so.1

Am I supposed to provide an absolute path to libX11.so.6?

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

@joepie91 No, we're just adding the text "libX11.so.6" to the list of dependencies in libGL. That means it can't find libGL, for some reason...

@joepie91
Copy link
Contributor Author

strace output:

sven@linux-etoq:~/libgl-shim> strace -f patchelf --add-needed libX11.so.6 libGL.so.1 -D
execve("/home/sven/.nix-profile/bin/patchelf", ["patchelf", "--add-needed", "libX11.so.6", "libGL.so.1", "-D"], [/* 97 vars */]) = 0
brk(0)                                  = 0x1b1d000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4acb03b000
access("/etc/ld-nix.so.preload", R_OK)  = -1 ENOENT (No such file or directory)
open("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/tls/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/tls/x86_64", 0x7ffc7cc46cf0) = -1 ENOENT (No such file or directory)
open("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/tls/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/tls", 0x7ffc7cc46cf0) = -1 ENOENT (No such file or directory)
open("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/x86_64", 0x7ffc7cc46cf0) = -1 ENOENT (No such file or directory)
open("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
open("/nix/store/caa7csilm0jrxissf994c1dmw6ri7dp7-gcc-4.9.3/lib/tls/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/caa7csilm0jrxissf994c1dmw6ri7dp7-gcc-4.9.3/lib/tls/x86_64", 0x7ffc7cc46cf0) = -1 ENOENT (No such file or directory)
open("/nix/store/caa7csilm0jrxissf994c1dmw6ri7dp7-gcc-4.9.3/lib/tls/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/caa7csilm0jrxissf994c1dmw6ri7dp7-gcc-4.9.3/lib/tls", 0x7ffc7cc46cf0) = -1 ENOENT (No such file or directory)
open("/nix/store/caa7csilm0jrxissf994c1dmw6ri7dp7-gcc-4.9.3/lib/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/nix/store/caa7csilm0jrxissf994c1dmw6ri7dp7-gcc-4.9.3/lib/x86_64", 0x7ffc7cc46cf0) = -1 ENOENT (No such file or directory)
open("/nix/store/caa7csilm0jrxissf994c1dmw6ri7dp7-gcc-4.9.3/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\260\5\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0555, st_size=1007624, ...}) = 0
mmap(NULL, 3188384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4acab08000
mprotect(0x7f4acabf3000, 2097152, PROT_NONE) = 0
mmap(0x7f4acadf3000, 45056, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xeb000) = 0x7f4acadf3000
mmap(0x7f4acadfe000, 83616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4acadfe000
close(3)                                = 0
open("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360W\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0555, st_size=1127110, ...}) = 0
mmap(NULL, 3154264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4aca800000
mprotect(0x7f4aca901000, 2097152, PROT_NONE) = 0
mmap(0x7f4acab01000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x101000) = 0x7f4acab01000
close(3)                                = 0
open("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p+\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0444, st_size=99780, ...}) = 0
mmap(NULL, 2184832, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4aca5e8000
mprotect(0x7f4aca5fd000, 2097152, PROT_NONE) = 0
mmap(0x7f4aca7fd000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f4aca7fd000
close(3)                                = 0
open("/nix/store/q0m70q5wg21hxrixkp1xk4x95sfs2fln-glibc-2.21/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\n\2\0\0\0\0\0"..., 832) = 832
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4acb037000
fstat(3, {st_mode=S_IFREG|0555, st_size=1920067, ...}) = 0
mmap(NULL, 3799584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4aca248000
mprotect(0x7f4aca3de000, 2097152, PROT_NONE) = 0
mmap(0x7f4aca5de000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x196000) = 0x7f4aca5de000
mmap(0x7f4aca5e4000, 14880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4aca5e4000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4acb036000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4acb034000
arch_prctl(ARCH_SET_FS, 0x7f4acb034740) = 0
mprotect(0x7f4aca5de000, 16384, PROT_READ) = 0
mprotect(0x7f4acab01000, 4096, PROT_READ) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4acb033000
mprotect(0x7f4acadf3000, 36864, PROT_READ) = 0
mprotect(0x7f4acb038000, 4096, PROT_READ) = 0
brk(0)                                  = 0x1b1d000
brk(0x1b3e000)                          = 0x1b3e000
stat("--add-needed", 0x7ffc7cc474a0)    = -1 ENOENT (No such file or directory)
dup(2)                                  = 3
fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4acb032000
write(3, "stat: No such file or directory\n", 32stat: No such file or directory
) = 32
close(3)                                = 0
munmap(0x7f4acb032000, 4096)            = 0
exit_group(1)                           = ?
+++ exited with 1 +++

@joepie91
Copy link
Contributor Author

Hmm. I don't think my version of patchelf supports --add-needed?

sven@linux-etoq:~/libgl-shim> patchelf --help
syntax: patchelf
  [--set-interpreter FILENAME]
  [--print-interpreter]
  [--set-rpath RPATH]
  [--shrink-rpath]
  [--print-rpath]
  [--force-rpath]
  [--remove-needed LIBRARY]
  [--debug]
  [--version]
  FILENAME

@vcunat
Copy link
Member

vcunat commented Sep 13, 2015

No, I don't think it does. It should be possible to copy and patchelf libX11 the same way as libGL, but I don't know... one also needs to redo this when you system packages are updated.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

No, I don't think it does. It should be possible to copy and patchelf libX11 the same way as libGL, but I don't know... one also needs to redo this when you system packages are updated.

That's possible, but I'd like to avoid it: it will also force things compiled in Nixpkgs to use that libX11, which will probably just cause more segfaults.

@vcunat
Copy link
Member

vcunat commented Sep 13, 2015

I would think it's possible for libGL to use a different libX11 than the ELFs using that libGL, but I don't remember the linking mechanism anymore.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

I would think it's possible for libGL to use a different libX11 than the ELFs using that libGL, but I don't remember the linking mechanism anymore.

It is, but we are overriding libGL with LD_LIBRARY_PATH. If we put libX11 on the same path, we will override that, too. That's why we're setting RPATH for libGL, so it can use its own libX11.

@joepie91
Copy link
Contributor Author

After installing an experimental version of patchelf, and doing this:

sven@linux-etoq:~/libgl-shim> patchelf --add-needed libX11.so.6 libGL.so.1

... this is the result:

sven@linux-etoq:~/redeclipse-1.5.3> /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ~/libgl-shim/libGL.so.1 
    linux-vdso.so.1 (0x00007ffd02600000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007fa10c290000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa10c070000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007fa10be58000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fa10baa8000)
    libxcb.so.1 => not found
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007fa10b8a0000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib64/ld-linux-x86-64.so.2 (0x00007fa10c7e8000)

... compared to pre-patch:

sven@linux-etoq:~/redeclipse-1.5.3> /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ~/libgl-shim/libGL.so.1 
    linux-vdso.so.1 (0x00007ffe45df0000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1658900000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f16586e8000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f1658338000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib64/ld-linux-x86-64.so.2 (0x00007f1658d30000)
    libX11.so.6 => not found

... so I guess that this is going to be a recursive problem.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

@joepie91 Yes, the "correct" solution here is to find all the libraries that get loaded when you run the host ldd on libGL (except linux-vdso.so and ld-*.so) and add them explicitly to libGL.

@joepie91
Copy link
Contributor Author

After doing this:

sven@linux-etoq:~/libgl-shim> patchelf --add-needed libxcb.so.1 libGL.so.1
sven@linux-etoq:~/libgl-shim> patchelf --add-needed libXau.so.6 libGL.so.1

... this is the result:

sven@linux-etoq:~/redeclipse-1.5.3> /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ~/libgl-shim/libGL.so.1 
    linux-vdso.so.1 (0x00007fff320c0000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007ff6ad580000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007ff6ad360000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007ff6ad020000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff6ace00000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007ff6acbe8000)
    libc.so.6 => /lib64/libc.so.6 (0x00007ff6ac838000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007ff6ac630000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib64/ld-linux-x86-64.so.2 (0x00007ff6ad9b8000)

Looks good to me - going to have a look at whether it Actually Works.

@joepie91
Copy link
Contributor Author

Hmm. It still doesn't work for Red Eclipse - it still segfaults, and ldd still shows it trying to grab the wrong libraries:

sven@linux-etoq:~/projects/nixpkgs/test/result/lib/redeclipse> LD_LIBRARY_PATH=~/libgl-shim/ /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ./redeclipse
    linux-vdso.so.1 (0x00007fff511f0000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007fec45930000)
    libSDL-1.2.so.0 => /nix/store/9sy7rrin9rd4j83mjwmgwc179s81miqg-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007fec45698000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007fec45478000)
    libSDL_image-1.2.so.0 => /nix/store/rzd2mf38xlwscky57mj5pbpgqk05viyh-SDL_image-1.2.12/lib/libSDL_image-1.2.so.0 (0x00007fec45258000)
    libSDL_mixer-1.2.so.0 => /nix/store/j7i02c53qcwbdlzj9rhc8314j2b2ah5h-SDL_mixer-1.2.12/lib/libSDL_mixer-1.2.so.0 (0x00007fec45008000)
    libz.so.1 => /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib/libz.so.1 (0x00007fec44df0000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007fec44bc0000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007fec449b8000)
    libstdc++.so.6 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6 (0x00007fec446a8000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007fec443a0000)
    libgcc_s.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libgcc_s.so.1 (0x00007fec44188000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007fec43de8000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007fec43bc8000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007fec439c0000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007fec437b8000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007fec435b0000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007fec43288000)
    libpulse-simple.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007fec43080000)
    libpulse.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007fec42e30000)
    libpulsecommon-6.0.so => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007fec42bb0000)
    libjson-c.so.2 => /nix/store/jaklgzhv2qcq9h71w95sw0c49dbrqc7r-json-c-0.12/lib/libjson-c.so.2 (0x00007fec429a0000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007fec42738000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007fec424c0000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007fec42208000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007fec41fd0000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007fec41dc8000)
    libdbus-1.so.3 => /nix/store/s42mk8l35nh0p3li6qq9gmpmq37dh7qf-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007fec41b80000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007fec41978000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007fec41760000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007fec41550000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007fec41340000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007fec45c70000)
    libpng16.so.16 => /nix/store/kxrznj68yq3ph6m2wc1vbxh4qw6ql2f2-libpng-apng-1.6.18/lib/libpng16.so.16 (0x00007fec41108000)
    libjpeg.so.62 => /nix/store/pfgx11m6kr910i2xrs3679faz3v67plf-libjpeg-turbo-1.4.1/lib/libjpeg.so.62 (0x00007fec40ea0000)
    libtiff.so.5 => /nix/store/pgs7icihncbf27n1jvlb30zbxwf7q5zc-libtiff-4.0.4beta/lib/libtiff.so.5 (0x00007fec40c28000)
    libfluidsynth.so.1 => /nix/store/sjx30jsbj84slvc6lp9riary46llqmfl-fluidsynth-1.1.6/lib/libfluidsynth.so.1 (0x00007fec40958000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007fec40748000)
    libsmpeg-0.4.so.0 => /nix/store/1rf3z0498vinjw4jjk4rx6fvnq55ahgm-smpeg-svn390/lib/libsmpeg-0.4.so.0 (0x00007fec404e8000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007fec402e0000)
    liblzma.so.5 => /nix/store/ivp3pna40wrq4i2whp4ijksfi4b8z58k-xz-5.2.1/lib/liblzma.so.5 (0x00007fec400b8000)
    libjack.so.0 => /nix/store/rhrj3y0nvxk0699jnrlfx30sh92nnxfc-libjack2-2015-06-02/lib/libjack.so.0 (0x00007fec3fe58000)
    libgthread-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libgthread-2.0.so.0 (0x00007fec3fc50000)
    libglib-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libglib-2.0.so.0 (0x00007fec3f918000)
    libopus.so.0 => /nix/store/984qsrday6gg7fv7m9r7dg8dv7x2fsxs-libopus-1.1/lib/libopus.so.0 (0x00007fec3f6c8000)

Not really sure what's going on here.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

That's because redeclipse probably also depends on libX11 and friends, and those load before libGL, so the linker reuses the already loaded ones. We should set the absolute paths to the required libraries in libGL instead, e.g. /usr/lib64/libX11.so.6 instead of just libX11.so.6.

@joepie91
Copy link
Contributor Author

It still segfaults, unfortunately.

On a clean copy of libGL:

sven@linux-etoq:~/libgl-shim> patchelf --add-needed /usr/lib64/libX11.so.6 libGL.so.1
sven@linux-etoq:~/libgl-shim> patchelf --add-needed /usr/lib64/libXau.so.6 libGL.so.1
sven@linux-etoq:~/libgl-shim> patchelf --add-needed /usr/lib64/libxcb.so.1 libGL.so.1
sven@linux-etoq:~/libgl-shim> patchelf --set-rpath /lib:/usr/lib:/lib64:/usr/lib64 libGL.so.1

[...]

sven@linux-etoq:~/projects/nixpkgs/test/result/lib/redeclipse> LD_LIBRARY_PATH=~/libgl-shim/ /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ./redeclipse
    linux-vdso.so.1 (0x00007fff16788000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007f5bf8f20000)
    libSDL-1.2.so.0 => /nix/store/9sy7rrin9rd4j83mjwmgwc179s81miqg-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007f5bf8c88000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007f5bf8a68000)
    libSDL_image-1.2.so.0 => /nix/store/rzd2mf38xlwscky57mj5pbpgqk05viyh-SDL_image-1.2.12/lib/libSDL_image-1.2.so.0 (0x00007f5bf8848000)
    libSDL_mixer-1.2.so.0 => /nix/store/j7i02c53qcwbdlzj9rhc8314j2b2ah5h-SDL_mixer-1.2.12/lib/libSDL_mixer-1.2.so.0 (0x00007f5bf85f8000)
    libz.so.1 => /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib/libz.so.1 (0x00007f5bf83e0000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007f5bf81b0000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007f5bf7fa8000)
    libstdc++.so.6 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6 (0x00007f5bf7c98000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007f5bf7990000)
    libgcc_s.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libgcc_s.so.1 (0x00007f5bf7778000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007f5bf73d8000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007f5bf71b8000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007f5bf6fb0000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007f5bf6da8000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007f5bf6ba0000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007f5bf6878000)
    libpulse-simple.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007f5bf6670000)
    libpulse.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007f5bf6420000)
    libpulsecommon-6.0.so => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007f5bf61a0000)
    libjson-c.so.2 => /nix/store/jaklgzhv2qcq9h71w95sw0c49dbrqc7r-json-c-0.12/lib/libjson-c.so.2 (0x00007f5bf5f90000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007f5bf5d28000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007f5bf5ab0000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007f5bf57f8000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007f5bf55c0000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007f5bf53b8000)
    libdbus-1.so.3 => /nix/store/s42mk8l35nh0p3li6qq9gmpmq37dh7qf-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007f5bf5170000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007f5bf4f68000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007f5bf4d50000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007f5bf4b40000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007f5bf4930000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007f5bf9260000)
    libpng16.so.16 => /nix/store/kxrznj68yq3ph6m2wc1vbxh4qw6ql2f2-libpng-apng-1.6.18/lib/libpng16.so.16 (0x00007f5bf46f8000)
    libjpeg.so.62 => /nix/store/pfgx11m6kr910i2xrs3679faz3v67plf-libjpeg-turbo-1.4.1/lib/libjpeg.so.62 (0x00007f5bf4490000)
    libtiff.so.5 => /nix/store/pgs7icihncbf27n1jvlb30zbxwf7q5zc-libtiff-4.0.4beta/lib/libtiff.so.5 (0x00007f5bf4218000)
    libfluidsynth.so.1 => /nix/store/sjx30jsbj84slvc6lp9riary46llqmfl-fluidsynth-1.1.6/lib/libfluidsynth.so.1 (0x00007f5bf3f48000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007f5bf3d38000)
    libsmpeg-0.4.so.0 => /nix/store/1rf3z0498vinjw4jjk4rx6fvnq55ahgm-smpeg-svn390/lib/libsmpeg-0.4.so.0 (0x00007f5bf3ad8000)
    /usr/lib64/libxcb.so.1 (0x00007f5bf38b8000)
    /usr/lib64/libXau.so.6 (0x00007f5bf36b0000)
    /usr/lib64/libX11.so.6 (0x00007f5bf3370000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007f5bf3168000)
    liblzma.so.5 => /nix/store/ivp3pna40wrq4i2whp4ijksfi4b8z58k-xz-5.2.1/lib/liblzma.so.5 (0x00007f5bf2f40000)
    libjack.so.0 => /nix/store/rhrj3y0nvxk0699jnrlfx30sh92nnxfc-libjack2-2015-06-02/lib/libjack.so.0 (0x00007f5bf2ce0000)
    libgthread-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libgthread-2.0.so.0 (0x00007f5bf2ad8000)
    libglib-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libglib-2.0.so.0 (0x00007f5bf27a0000)
    libopus.so.0 => /nix/store/984qsrday6gg7fv7m9r7dg8dv7x2fsxs-libopus-1.1/lib/libopus.so.0 (0x00007f5bf2550000)

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

@joepie91 Your libGL also needs libXext.

@joepie91
Copy link
Contributor Author

That doesn't seem to fix it. Latest ldd output:

sven@linux-etoq:~/projects/nixpkgs/test/result/lib/redeclipse> LD_LIBRARY_PATH=~/libgl-shim/ /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/bin/ldd ./redeclipse
    linux-vdso.so.1 (0x00007ffec5958000)
    libX11.so.6 => /nix/store/9ml7lw7ajnk7jxc1mvrbywqldn0yb98s-libX11-1.6.3/lib/libX11.so.6 (0x00007f3fb4278000)
    libSDL-1.2.so.0 => /nix/store/9sy7rrin9rd4j83mjwmgwc179s81miqg-SDL-1.2.15/lib/libSDL-1.2.so.0 (0x00007f3fb3fe0000)
    libpthread.so.0 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libpthread.so.0 (0x00007f3fb3dc0000)
    libSDL_image-1.2.so.0 => /nix/store/rzd2mf38xlwscky57mj5pbpgqk05viyh-SDL_image-1.2.12/lib/libSDL_image-1.2.so.0 (0x00007f3fb3ba0000)
    libSDL_mixer-1.2.so.0 => /nix/store/j7i02c53qcwbdlzj9rhc8314j2b2ah5h-SDL_mixer-1.2.12/lib/libSDL_mixer-1.2.so.0 (0x00007f3fb3950000)
    libz.so.1 => /nix/store/alsvwzkiw4b7ip38l4nlfjijdvg3fvzn-zlib-1.2.8/lib/libz.so.1 (0x00007f3fb3738000)
    libGL.so.1 => /home/sven/libgl-shim/libGL.so.1 (0x00007f3fb34f8000)
    librt.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/librt.so.1 (0x00007f3fb32f0000)
    libstdc++.so.6 => /nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6 (0x00007f3fb2fe0000)
    libm.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libm.so.6 (0x00007f3fb2cd8000)
    libgcc_s.so.1 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libgcc_s.so.1 (0x00007f3fb2ac0000)
    libc.so.6 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libc.so.6 (0x00007f3fb2720000)
    libxcb.so.1 => /nix/store/pzc1cmnbn0ch6ilgi64clxvlx2v23q4p-libxcb-1.11/lib/libxcb.so.1 (0x00007f3fb2500000)
    libXau.so.6 => /nix/store/nk2gxi8kq0qanw43ssiirw7kza8qb0ia-libXau-1.0.8/lib/libXau.so.6 (0x00007f3fb22f8000)
    libXdmcp.so.6 => /nix/store/fspwri6dyw5r658wr0dxxxmpf0q96vy1-libXdmcp-1.1.2/lib/libXdmcp.so.6 (0x00007f3fb20f0000)
    libdl.so.2 => /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libdl.so.2 (0x00007f3fb1ee8000)
    libasound.so.2 => /nix/store/vjszhl1hh62qlk6rqzqdidjfpxd519n5-alsa-lib-1.0.29/lib/libasound.so.2 (0x00007f3fb1bc0000)
    libpulse-simple.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse-simple.so.0 (0x00007f3fb19b8000)
    libpulse.so.0 => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/libpulse.so.0 (0x00007f3fb1768000)
    libpulsecommon-6.0.so => /nix/store/6v1gd5apxh6kda9xpak54n75j3s9jrm9-libpulseaudio-6.0/lib/pulseaudio/libpulsecommon-6.0.so (0x00007f3fb14e8000)
    libjson-c.so.2 => /nix/store/jaklgzhv2qcq9h71w95sw0c49dbrqc7r-json-c-0.12/lib/libjson-c.so.2 (0x00007f3fb12d8000)
    libsndfile.so.1 => /nix/store/gn43gi6d25idldfw3wyvhigf7ah7i65w-libsndfile-1.0.25/lib/libsndfile.so.1 (0x00007f3fb1070000)
    libFLAC.so.8 => /nix/store/qqirmdsi35rz753jj33f9h61c3rzwi0n-flac-1.3.1/lib/libFLAC.so.8 (0x00007f3fb0df8000)
    libvorbisenc.so.2 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisenc.so.2 (0x00007f3fb0b40000)
    libvorbis.so.0 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbis.so.0 (0x00007f3fb0908000)
    libogg.so.0 => /nix/store/f55clf16r2lkq5c18pnfarbf13d9z62p-libogg-1.3.2/lib/libogg.so.0 (0x00007f3fb0700000)
    libdbus-1.so.3 => /nix/store/s42mk8l35nh0p3li6qq9gmpmq37dh7qf-dbus-libs-1.8.20/lib/libdbus-1.so.3 (0x00007f3fb04b8000)
    libcap.so.2 => /nix/store/1yq6l4hdfrki9vxrxrciqfaf4z0cflvw-libcap-2.24/lib/libcap.so.2 (0x00007f3fb02b0000)
    libXext.so.6 => /nix/store/75m6jc60b3p6ppviwbp37sf6xkvwhx72-libXext-1.3.3/lib/libXext.so.6 (0x00007f3fb0098000)
    libXrandr.so.2 => /nix/store/1w8ms3a1lmmvrdszx3zi1056wav0jmff-libXrandr-1.5.0/lib/libXrandr.so.2 (0x00007f3fafe88000)
    libXrender.so.1 => /nix/store/hl26m6jg9hdr31lv73g7vg78174sy3wx-libXrender-0.9.9/lib/libXrender.so.1 (0x00007f3fafc78000)
    /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/ld-linux-x86-64.so.2 (0x00007f3fb45b8000)
    libpng16.so.16 => /nix/store/kxrznj68yq3ph6m2wc1vbxh4qw6ql2f2-libpng-apng-1.6.18/lib/libpng16.so.16 (0x00007f3fafa40000)
    libjpeg.so.62 => /nix/store/pfgx11m6kr910i2xrs3679faz3v67plf-libjpeg-turbo-1.4.1/lib/libjpeg.so.62 (0x00007f3faf7d8000)
    libtiff.so.5 => /nix/store/pgs7icihncbf27n1jvlb30zbxwf7q5zc-libtiff-4.0.4beta/lib/libtiff.so.5 (0x00007f3faf560000)
    libfluidsynth.so.1 => /nix/store/sjx30jsbj84slvc6lp9riary46llqmfl-fluidsynth-1.1.6/lib/libfluidsynth.so.1 (0x00007f3faf290000)
    libvorbisfile.so.3 => /nix/store/g77q8cq3y21nkf9f6ndj0gvjr4x4mk9a-libvorbis-1.3.5/lib/libvorbisfile.so.3 (0x00007f3faf080000)
    libsmpeg-0.4.so.0 => /nix/store/1rf3z0498vinjw4jjk4rx6fvnq55ahgm-smpeg-svn390/lib/libsmpeg-0.4.so.0 (0x00007f3faee20000)
    /usr/lib64/libXext.so.6 (0x00007f3faec08000)
    /usr/lib64/libxcb.so.1 (0x00007f3fae9e8000)
    /usr/lib64/libXau.so.6 (0x00007f3fae7e0000)
    /usr/lib64/libX11.so.6 (0x00007f3fae4a0000)
    libattr.so.1 => /nix/store/1a5pkc2sm5jd71hxxi9hj9211cc79mck-attr-2.4.47/lib/libattr.so.1 (0x00007f3fae298000)
    liblzma.so.5 => /nix/store/ivp3pna40wrq4i2whp4ijksfi4b8z58k-xz-5.2.1/lib/liblzma.so.5 (0x00007f3fae070000)
    libjack.so.0 => /nix/store/rhrj3y0nvxk0699jnrlfx30sh92nnxfc-libjack2-2015-06-02/lib/libjack.so.0 (0x00007f3fade10000)
    libgthread-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libgthread-2.0.so.0 (0x00007f3fadc08000)
    libglib-2.0.so.0 => /nix/store/26zyb2byw1sqr2afbz6ql3352ri847jd-glib-2.44.1/lib/libglib-2.0.so.0 (0x00007f3fad8d0000)
    libopus.so.0 => /nix/store/984qsrday6gg7fv7m9r7dg8dv7x2fsxs-libopus-1.1/lib/libopus.so.0 (0x00007f3fad680000)

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

It looks good to me:

    /usr/lib64/libXext.so.6 (0x00007f3faec08000)
    /usr/lib64/libxcb.so.1 (0x00007f3fae9e8000)
    /usr/lib64/libXau.so.6 (0x00007f3fae7e0000)
    /usr/lib64/libX11.so.6 (0x00007f3fae4a0000)

Is it still segfaulting?

@joepie91
Copy link
Contributor Author

Yeah.

sven@linux-etoq:~/projects/nixpkgs/test/result/lib/redeclipse> LD_LIBRARY_PATH=~/libgl-shim/ gdb ./redeclipse
GNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
..
Reading symbols from /nix/store/wbiq5zzdzc0d2j3y6g0yfy06qbi0i8lw-red-eclipse-1.5.3/lib/redeclipse/redeclipse...(no debugging symbols found)...done.
(gdb) run
Starting program: /nix/store/wbiq5zzdzc0d2j3y6g0yfy06qbi0i8lw-red-eclipse-1.5.3/lib/redeclipse/redeclipse 
warning: File "/nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libthread_db-1.0.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
    add-auto-load-safe-path /nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libthread_db-1.0.so
line to your configuration file "/home/sven/.gdbinit".
To completely disable this security protection add
    set auto-load safe-path /
line to your configuration file "/home/sven/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
    info "(gdb)Auto-loading safe path"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
Missing separate debuginfo for /home/sven/libgl-shim/libGL.so.1
warning: File "/nix/store/kpzihgr24vi2rrxcdfv3grnfcaw7jvf4-gcc-4.9.3/lib/libstdc++.so.6.0.20-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
Missing separate debuginfo for /usr/lib64/libXext.so.6
Try: zypper install -C "debuginfo(build-id)=0807b733a052985c11b6dc268d24d7be6fde68a1"
Missing separate debuginfo for /usr/lib64/libxcb.so.1
Try: zypper install -C "debuginfo(build-id)=d3ca8665813dd850a9dc3d83639d23b9dd099cf2"
Missing separate debuginfo for /usr/lib64/libXau.so.6
Try: zypper install -C "debuginfo(build-id)=1d9338bd0b89e7530cd331c277f93d6bdd420103"
Missing separate debuginfo for /usr/lib64/libX11.so.6
Try: zypper install -C "debuginfo(build-id)=bc2bf51620a006d6392286492c766444d7468bf9"
Missing separate debuginfo for /usr/X11R6/lib64/modules/dri/fglrx_dri.so

Program received signal SIGSEGV, Segmentation fault.
0x00007fffeff811a7 in ?? () from /usr/X11R6/lib64/modules/dri/fglrx_dri.so

strace excerpt:

[...]
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365050, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365050, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234B\2\0\0\0\0\0", 8}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 8
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\0\16\0\0\0\0\0\1\10\247c\223\177\0\0\0\0\0\0\0\0\0\0D\5\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365000, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365000, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234E\2\0\0\0\0\0", 8}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 8
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\0\17\0\2\0\0\0\17\0\0\0\24\0\0\0\3\0\0\0\5\0\0\0D\5\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 40
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364fe0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364fe0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
geteuid( [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                               = 1000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
getuid( [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 1000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/X11R6/lib64/modules/dri/fglrx_dri.so", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 6
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
read(6,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300C+\0\0\0\0\0"..., 832) = 832
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
fstat(6,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFREG|0755, st_size=40004512, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(NULL, 42335432, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 6, 0 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2c9eb88000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mprotect(0x7f2ca0fdb000, 1044480, PROT_NONE [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(0x7f2ca10da000, 1908736, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 6, 0x2452000 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2ca10da000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(0x7f2ca12ac000, 1293512, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2ca12ac000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
close(6 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
openat(AT_FDCWD, "/sys/devices/system/cpu", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 6
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
getdents(6,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
/* 21 entries */, 32768)    = 608
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
getdents(6,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
/* 0 entries */, 32768)     = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
close(6 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/home/sven/libgl-shim/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
gettid( [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 26449
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/home/sven/libgl-shim/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
brk(0x22d6000 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                          = 0x22d6000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atioes.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)  = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/proc/26449/cmdline", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)   = 6
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
read(6,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"./redeclipse\0-F\0", 255)      = 16
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
close(6 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/egl/atiapfxxES.blb", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atiogl_perfcount.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/home/sven/libgl-shim/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/home/sven/libgl-shim/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
gettid( [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 26449
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
gettid( [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 26449
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atiogl.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)  = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/dev/ati/card0", O_RDWR [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)          = 6
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atiogl_perfcount.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
readlink("/proc/self/exe",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"/nix/store/wbiq5zzdzc0d2j3y6g0yf"..., 512) = 87
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atiogl.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)  = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
readlink("/proc/self/exe",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"/nix/store/wbiq5zzdzc0d2j3y6g0yf"..., 8192) = 87
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
readlink("/proc/self/exe",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"/nix/store/wbiq5zzdzc0d2j3y6g0yf"..., 8192) = 87
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
brk(0x22f7000 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                          = 0x22f7000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234\7\3\0\0\0\0\0\4\0\0\0", 12}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 12
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\16\20\0L\1\0\0\0\0\0\0\1\0\0\0\0\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 1360
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364b50, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364b50, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\233\23\3\0\0\0\0\0\2\0\0\0", 12}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 12
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\330\21\0\1\0\0\0007v\235a\4\0\0\0p\364\204\1\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 36
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\233\25\2\0\0\0\0\0", 8}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 8
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\330\22\0&\20\0\0005\0\0\0'\0\0\0p\364\204\1\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 4096
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvfrom(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"\23\200\0\0000\0\0\0\22\200\0\0\1\0\0\0\4\0\0\0\1\0\0\0\21\200\0\0\1\0\0\0"..., 12472, 0, NULL, NULL) = 12472
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365100, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365100, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234C\2\0\0\0\0\0", 8}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 8
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\372\23\0\3\0\0\0\0\300\235\32\0\0\0\0\t\0\0\0\0\0\0\0mj\221`\223\177\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 44
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/home/sven/libgl-shim/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib/tls/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib/tls/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib/tls/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib/tls",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950)        = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950)     = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib/tls/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/usr/lib/tls/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib/tls/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/usr/lib/tls",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950)    = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/usr/lib/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 7
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
read(7,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340=\0\0004\0\0\0"..., 832) = 832
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
close(7 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/usr/lib",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFDIR|0755, st_size=28672, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib64/tls/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib64/tls/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib64/tls/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib64/tls",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950)      = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib64/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib64/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950)   = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/lib64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/lib64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib64/tls/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/usr/lib64/tls/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib64/tls/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/usr/lib64/tls",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950)  = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib64/x86_64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/usr/lib64/x86_64",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364950) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/usr/lib64/libatiuki.so.1", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 7
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
read(7,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@Q\0\0\0\0\0\0"..., 832) = 832
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
fstat(7,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFREG|0755, st_size=152442, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(NULL, 1183208, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 7, 0 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2ca8b88000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mprotect(0x7f2ca8b98000, 1048576, PROT_NONE [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(0x7f2ca8c98000, 69632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 7, 0x10000 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2ca8c98000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
close(7 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semget(0x111442b, 1, IPC_CREAT|IPC_EXCL|0666 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 EEXIST (File exists)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semget(0x111442b, 1, 0666 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)              = 32769
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semop(32769, {{0, -1, SEM_UNDO}}, 1 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)    = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/proc/ati/major", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)       = 7
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
fstat(7,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFREG|0444, st_size=0, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2ca8caa000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
read(7,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"250\n", 1024)                  = 4
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
close(7 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
munmap(0x7f2ca8caa000, 4096 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)            = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/proc/ati/major", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)       = 7
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
fstat(7,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFREG|0444, st_size=0, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2ca8caa000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
read(7,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"250\n", 1024)                  = 4
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
close(7 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                                = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
munmap(0x7f2ca8caa000, 4096 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)            = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
geteuid( [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                               = 1000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/dev/ati",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFDIR|0755, st_size=60, ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
stat("/dev/ati/card0",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{st_mode=S_IFCHR|0666, st_rdev=makedev(250, 0), ...}) = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/dev/ati/card0", O_RDWR [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)          = 7
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semget(0x29110806, 1, IPC_CREAT|IPC_EXCL|0666 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 EEXIST (File exists)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semget(0x29110806, 1, 0666 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)             = 65538
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semop(65538, {{0, -1, SEM_UNDO}}, 1 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)    = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
ioctl(7, 0x80046484 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
, 0x7fff1f36501c)    = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semop(65538, {{0, 1, SEM_UNDO}}, 1 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)     = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
ioctl(7, 0xc0106407 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
, 0x7fff1f365190)    = -1 EINVAL (Invalid argument)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
ioctl(7, 0xc0106401 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
, 0x7fff1f365190)    = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
ioctl(7, 0xc0106401 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
, 0x7fff1f365190)    = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
semop(32769, {{0, 1, SEM_UNDO}}, 1 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)     = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
ioctl(7, 0x80046402 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
, 0x7fff1f36527c)    = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
ioctl(7, 0xc0406400 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
, 0x22e3ea0)         = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
ioctl(7, 0xc0406400 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
, 0x22e3ea0)         = 0
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234L\3\0\0\0\0\0p\0\0\0", 12}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 12
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\16\24\0\0\0\0\0\1\0\0\0\0\0\0\0\300T\331\1\0\0\0\0i\256_]\223\177\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234E\2\0\0\0\0\0", 8}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 8
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\16\25\0\2\0\0\0\17\0\0\0\24\0\0\0\3\0\0\0\5\0\0\0i\256_]\223\177\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 40
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365090, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365090, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234K\2\0\0\0\0\0", 8}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 8
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\0\26\0\342\5\0\0\0\320\235\32\0\0\0\0\0\0\0\0\0\0\0\20\0<\0\0\210\27\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 4096
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvfrom(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1960, 0, NULL, NULL) = 1960
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365090, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f365090, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_SHARED, 7, 0x1a9dc000 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 0x7f2ca8b84000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"bK\6\0\17\0\0\0", 8}, {"ATIFGLEXTENSION", 15}, {"\0", 1}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 24
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\0\27\0\0\0\0\0\1\234\0\266\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364fd0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364fd0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234M\2\0\0\0\0\0", 8}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 8
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1@\30\0b\0\0\0001\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\260X\334\1\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 424
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f3650b0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN|POLLOUT}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLOUT}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
writev(5, [{"\234\7\3\0\0\0\0\0p\0\0\0", 12}, {NULL, 0}, {"", 0}], 3 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 12
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
poll([{fd=5, events=POLLIN}], 1, 4294967295 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = 1 ([{fd=5, revents=POLLIN}])
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
{msg_name(0)=NULL, msg_iov(1)=[{"\1\16\31\0L\1\0\0\0\0\0\0\1\0\0\0\0\0\0\0\3\0\0\0\1\0\0\0\0\0\0\0"..., 4096}], msg_controllen=0, msg_flags=0}, 0) = 1360
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364900, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
recvmsg(5,  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
0x7fff1f364900, 0)           = -1 EAGAIN (Resource temporarily unavailable)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
brk(0x231a000 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)                          = 0x231a000
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atiogl.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)  = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atiogl_perfcount.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
readlink("/proc/self/exe",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"/nix/store/wbiq5zzdzc0d2j3y6g0yf"..., 512) = 87
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/home/sven/libgl-shim/libatiadlxx.so", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/nix/store/qlxp7vb63fp8kx5vk9a0y3rj8svbvl27-glibc-2.21/lib/libatiadlxx.so", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133
) = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
open("/etc/X11/atiogl.conf", O_RDONLY [wait(0x857f) = 26449] WIFSTOPPED,sig=133
)  = -1 ENOENT (No such file or directory)
 [wait(0x857f) = 26449] WIFSTOPPED,sig=133
readlink("/proc/self/exe",  [wait(0x857f) = 26449] WIFSTOPPED,sig=133
"/nix/store/wbiq5zzdzc0d2j3y6g0yf"..., 8192) = 87
 [wait(0x0b7f) = 26449] WIFSTOPPED,sig=SIGSEGV
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x338} ---
 [wait(0x000b) = 26449] WIFSIGNALED,sig=SIGSEGV
+++ killed by SIGSEGV +++
dropped tcb for pid 26449, 0 remain
Segmentation fault

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x338} ---

The error code here (SEGV_MAPERR) suggests that some symbol was not resolved correctly. I'm guessing that it has something to do with this:

open("/home/sven/libgl-shim/libatiadlxx.so", O_RDONLY|O_CLOEXEC [wait(0x857f) = 26449] WIFSTOPPED,sig=133 ) = -1 ENOENT (No such file or directory)

This is that library that it's trying to dlopen (or something). It never does successfully load this library. I still think you need to copy it to $HOME/libgl-shim for the drivers to find it. You should patch it the same way we did with libGL: set its RPATH, run the Nix ldd on it, and --add-needed (by absolute path) any libraries that are still missing.

@vcunat
Copy link
Member

vcunat commented Sep 13, 2015

Yes, libGL loads drivers by dlopen, IIRC. Those are also affected by our RPATHs and stuff. It's a bit more difficult than I anticipated, because we can't choose the dynamic loader (loading algorithm) per library.

@ttuegel
Copy link
Member

ttuegel commented Sep 13, 2015

I think this way is probably a dead-end. The easiest way forward would probably be to use the Catalyst libGL in Nixpkgs. There's an option to build just the libraries, so you should be able to use it with your host kernel module. The kernel driver interface should be very stable (e.g. I know it's stable between 32- and 64-bit kernels), but if it doesn't work out-of-the-box, you would only have to modify the package to use the same version of Catalyst as is on your system.

@Profpatsch
Copy link
Member

(triage) what’s the status?

@ttuegel
Copy link
Member

ttuegel commented Jul 23, 2016

This is as fixed as it will ever be on the Nixpkgs side.

@ttuegel ttuegel closed this as completed Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants