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

Move to libglvnd for OpenGL #37369

Closed
wants to merge 25 commits into from
Closed

Move to libglvnd for OpenGL #37369

wants to merge 25 commits into from

Conversation

abbradar
Copy link
Member

@abbradar abbradar commented Mar 19, 2018

Motivation for this change
  • Removes somewhat need for LD_LIBRARY_PATH in NixOS (it's still left for other usecases but it would be much more simple to get rid of it now) (actually not because GLX vendor implementations are searched by name -- it would be needed to patch those too. Still, at least no libraries should be overridden now with LD_LIBRARY_PATH in usual case, it should be only used for dlopen search);
  • Shrinks closure size of both libGL and mesa_noglu.out;
  • Fixes libGL not working on non-NixOS (without setting up) #9415 with newer video drivers. (actually not because libc/libstdc++ would still mix -- it needs something akin to libcapsule. Would help with simple cases though)

Besides doing the move itself I've done two more changes:

  • Dropped X libraries from our display-manager.service's LD_LIBRARY_PATH; see commit message for why was it done. tl;dr: it seems to not be needed anymore so this is a cleanup.
  • Added virgl driver to Mesa and OpenGL support to Qemu. This still doesn't work (Qemu segfaults when using OpenGL support and trying to get virgl acceleration) but hopefully we won't need another mass rebuild to fix this. Initially I wanted to use it for testing this change.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Tested on:

  1. A system with unfree NVIDIA drivers (my desktop, full configuration);
  2. A system with Mesa drivers (my laptop, full configuration);
  3. Steam;
  4. Bumblebee.

This can break packages; usual fix is to add mesa_noglu (for gbm, dri and other dependencies) or libdrm (it was propagated before I think).

cc @vcunat (I remember you tried this some time ago).

Move driverLink attribute there.
It's used for 3D acceleration inside qemu.
* Implement libGL as a symlink package which uses libraries from libglvnd and
  headers from Mesa (since ones from libglvnd are outdated).
* Use libGL_driver.driverLink treewide; add FHS paths where possible.
In resulting derivation there's no mention of this path anyway (checked with grep).
This is needed for OpenGL support.
* Fix shebang so that it's usable on NixOS;
* Enable warnings (they were enabled with Perl flag before);
* Switch from mesa to libGL.
X libraries in LD_LIBRARY_PATH seem to not be needed anymore.
I've tracked this addition as far as I could
(02cef04) and they seem to be added for unfree
NVIDIA and ATI drivers but at least for NVIDIA they are not needed anymore. We
can add them with patchelf instead if it turns out to be the case with ATI.
Our patch which adds this envvar has been removed.
Also remove duplicate libGLU.
They seem to no longer be needed.
@abbradar
Copy link
Member Author

To boast a little:

➜  ~ ls /run/opengl-driver/lib | grep libGL
libGLX_mesa.la
libGLX_mesa.so
libGLX_mesa.so.0
libGLX_mesa.so.0.0.0
➜  ~ glxinfo | grep version                
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.3.6
OpenGL core profile shading language version string: 4.50
OpenGL version string: 3.0 Mesa 17.3.6
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 17.3.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
➜  ~ 

@oxij
Copy link
Member

oxij commented Mar 27, 2018 via email

@abbradar
Copy link
Member Author

@oxij Not sure I understood you, do you mean it's possible libglvnd doesn't export all GL symbols for some latest standard? I don't think that'll happen in practice -- libglvnd is used by NVIDIA's driver to export symbols and it's largely autogenerated.

@oxij
Copy link
Member

oxij commented Mar 28, 2018 via email

gebner added a commit that referenced this pull request Apr 15, 2018
libGL.so is no longer in LD_LIBRARY_PATH since #37369
@NixOS NixOS deleted a comment from abbradar May 11, 2018
@NixOS NixOS deleted a comment from avnik May 11, 2018
@NixOS NixOS deleted a comment from abbradar May 11, 2018
@Mic92
Copy link
Member

Mic92 commented May 13, 2018

Is this indented that I have to add mesa_noglu to xorgserver now?
Currently it is broken: https://hydra.nixos.org/build/74046691

@andrewrk
Copy link
Member

andrewrk commented Sep 9, 2018

This broke glfw and/or libepoxy, whichever one tries to find libGL.so.1. It also broke zsnes.

@avnik
Copy link
Contributor

avnik commented Sep 9, 2018 via email

@andrewrk
Copy link
Member

andrewrk commented Sep 9, 2018

If there's a static executable that wants to work on all Linux platforms, how can it find OpenGL in such a way that it will find the correct version on NixOS?

@Mic92
Copy link
Member

Mic92 commented Sep 9, 2018

Static executables do not load dynamic libraries. Dynamically linked executables either load libraries from LD_LIBRARY_PATH environment variable or the rpath that is set in the executable (the latter one can be adjusted with patchelf)

@andrewrk
Copy link
Member

andrewrk commented Sep 9, 2018

static executables can load dynamic libraries just fine. Here's a test case covering this behavior: https://github.com/ziglang/zig/tree/7c9f7b72c59e7c6de38038f512ae332fc164e8d7/test/standalone/load_dynamic_library

on my system,
LD_LIBRARY_PATH=/run/opengl-driver/lib:/run/opengl-driver-32/lib

in this dir:

bellagio              libtxc_dxtn.so         libXvMCgallium.so.1
d3d                   libtxc_dxtn.so.0       libXvMCgallium.so.1.0.0
dri                   libtxc_dxtn.so.0.0.0   libXvMCnouveau.so
libEGL_mesa.la        libvulkan_intel.la     libXvMCnouveau.so.1
libEGL_mesa.so        libvulkan_intel.so     libXvMCnouveau.so.1.0
libEGL_mesa.so.0      libvulkan_radeon.la    libXvMCnouveau.so.1.0.0
libEGL_mesa.so.0.0.0  libvulkan_radeon.so    libXvMCr600.so
libGLX_mesa.la        libxatracker.la        libXvMCr600.so.1
libGLX_mesa.so        libxatracker.so        libXvMCr600.so.1.0
libGLX_mesa.so.0      libxatracker.so.2      libXvMCr600.so.1.0.0
libGLX_mesa.so.0.0.0  libxatracker.so.2.3.0  pkgconfig
libtxc_dxtn.la        libXvMCgallium.so      vdpau

how is code supposed to know which one to load?

@oxij
Copy link
Member

oxij commented Sep 9, 2018 via email

@avnik
Copy link
Contributor

avnik commented Sep 10, 2018 via email

@andrewrk
Copy link
Member

andrewrk commented Sep 16, 2018

Here's a how-to repro: #46423 (comment)

Also I double checked zsnes, and actually it was already fixed. My mistake on zsnes. epoxy still a problem though.

@cx405
Copy link

cx405 commented Nov 4, 2018

Just migrated to 18.09 from 18.03, and have trouble with openarena package:

$ openarena
/nix/store/a1jmb86qk6fj3zvdmixhpwxlv1phliw6-openarena-0.8.8/openarena-0.8.8/openarena.x86_64: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory

$ echo $LD_LIBRARY_PATH
/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane:/run/opengl-driver/lib:/run/opengl-driver-32/lib

$ ls -1 /run/opengl-driver/lib
bellagio
d3d
dri
libEGL_mesa.la
libEGL_mesa.so
libEGL_mesa.so.0
libEGL_mesa.so.0.0.0
libGLX_mesa.la
libGLX_mesa.so
libGLX_mesa.so.0
libGLX_mesa.so.0.0.0
libtxc_dxtn.la
libtxc_dxtn.so
libvulkan_intel.la
libvulkan_intel.so
libvulkan_radeon.la
libvulkan_radeon.so
libxatracker.la
libxatracker.so
libxatracker.so.2
libxatracker.so.2.3.0
libXvMCgallium.so
libXvMCgallium.so.1
libXvMCgallium.so.1.0.0
libXvMCnouveau.so
libXvMCnouveau.so.1
libXvMCnouveau.so.1.0
libXvMCnouveau.so.1.0.0
libXvMCr600.so
libXvMCr600.so.1
libXvMCr600.so.1.0
libXvMCr600.so.1.0.0
vdpau

It worked in 18.03.

@Mic92
Copy link
Member

Mic92 commented Nov 5, 2018

LD_DEBUG=all can be handy to debug library search problems: http://www.bnikolic.co.uk/blog/linux-ld-debug.html

@cx405
Copy link

cx405 commented Nov 5, 2018

@Mic92 Looks like it just tries to locate the library that isn't there:

      2630:     file=libGL.so.1 [0];  needed by /nix/store/a1jmb86qk6fj3zvdmixhpwxlv1phliw6-openarena-0.8.8/openarena-0.8.8/openarena.x86_64 [0]
      2630:     find library=libGL.so.1 [0]; searching
      2630:      search path=/nix/store/833lmkfczmbzmxfnvhb00bl0kmb9yly3-SDL-1.2.15/lib:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls/x86_64/x86_64:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls/x86_64:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls/x86_64:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/x86_64/x86_64:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/x86_64:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/x86_64:/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls/x86_64/x86_64:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls/x86_64:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls/x86_64:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/x86_64/x86_64:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/x86_64:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/x86_64:/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls/x86_64/x86_64:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls/x86_64:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls/x86_64:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/x86_64/x86_64:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/x86_64:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/x86_64:/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls/x86_64/x86_64:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls/x86_64:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls/x86_64:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/x86_64/x86_64:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/x86_64:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/x86_64:/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane:/run/opengl-driver/lib/tls/x86_64/x86_64:/run/opengl-driver/lib/tls/x86_64:/run/opengl-driver/lib/tls/x86_64:/run/opengl-driver/lib/tls:/run/opengl-driver/lib/x86_64/x86_64:/run/opengl-driver/lib/x86_64:/run/opengl-driver/lib/x86_64:/run/opengl-driver/lib:/run/opengl-driver-32/lib/tls/x86_64/x86_64:/run/opengl-driver-32/lib/tls/x86_64:/run/opengl-driver-32/lib/tls/x86_64:/run/opengl-driver-32/lib/tls:/run/opengl-driver-32/lib/x86_64/x86_64:/run/opengl-driver-32/lib/x86_64:/run/opengl-driver-32/lib/x86_64:/run/opengl-driver-32/lib(LD_LIBRARY_PATH)
      2630:       trying file=/nix/store/833lmkfczmbzmxfnvhb00bl0kmb9yly3-SDL-1.2.15/lib/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/tls/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/8fz98xhlk563kgsvmvihyj8m6i22pcc7-libogg-1.3.3/lib/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/tls/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fw6kv6w6fjh5q7pmnr470pkp93ds13hb-libvorbis-1.3.6/lib/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/tls/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/9c9vryq51hlw0jr8ddk2yk1qvkaq0vl2-curl-7.61.0/lib/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/tls/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/x86_64/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/x86_64/libGL.so.1
      2630:       trying file=/nix/store/mb471p2iqq73lfz9z41p7gbszpa3rk9r-sane-config/lib/sane/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/tls/x86_64/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/tls/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/x86_64/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver/lib/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/tls/x86_64/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/tls/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/x86_64/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/x86_64/libGL.so.1
      2630:       trying file=/run/opengl-driver-32/lib/libGL.so.1
      2630:      search cache=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/etc/ld.so.cache
      2630:      search path=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls/x86_64/x86_64:/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls/x86_64:/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls/x86_64:/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls:/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/x86_64/x86_64:/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/x86_64:/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/x86_64:/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib            (system search path)
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/tls/libGL.so.1
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/x86_64/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/x86_64/libGL.so.1
      2630:       trying file=/nix/store/fg4yq8i8wd08xg3fy58l6q73cjy8hjr2-glibc-2.27/lib/libGL.so.1
      2630:
/nix/store/a1jmb86qk6fj3zvdmixhpwxlv1phliw6-openarena-0.8.8/openarena-0.8.8/openarena.x86_64: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory

Same for minetest package:

$ minetest
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  156 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  45
  Current serial number in output stream:  46

I would appreciate if someone can explain how to point these to correct library or recompile, checking the store and pushing these off and back from configuration.nix was fruitless.

Strangely, another Opengl application - Zandronum, works. Glxinfo works as well.

@avnik
Copy link
Contributor

avnik commented Nov 5, 2018

But minetest works on master, so it definelly different problem

@joepie91
Copy link
Contributor

joepie91 commented Mar 3, 2019

This change seems to have broken most all OpenGL-based things in Rust, given that glutin hardcodes the library names - this is rather inconvenient when developing things, since this seems to make it impossible to use nix-shell alongside Cargo to write and test Rust graphics code.

Edit: Adding libGL to the dependencies in my shell.nix seems to maybe work? I have no idea whether it's actually rendering stuff on my GPU or using some sort of software OpenGL implementation.

@jb55
Copy link
Contributor

jb55 commented May 21, 2019

If there's a static executable that wants to work on all Linux platforms, how can it find OpenGL in such a way that it will find the correct version on NixOS?

I think this is a valid point. I'm working on a game and I'm looking to do static linking to maximize portability between distros. A common practice when distributing games is to dlopen libGL to fetch all the available opengl function pointers.

It seems like this assumption is no longer valid? If I was a game developer attempting to target most linux distros what would I do? Please don't say steam runtime :|

@jb55
Copy link
Contributor

jb55 commented May 21, 2019

I think I was confused, it doesn't look like you can do what I was looking to do. I think if I just link SDL2 and use the load functions from there it should be fine...

@avnik
Copy link
Contributor

avnik commented May 21, 2019

@jb55 at least we have both SDL and SDL2 correctly patched to find all libraries in nixos in proper places. If you plan closed source game -- maybe env variable can be good level of indirection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet