当我尝试运行使用由 Nix 包管理器安装或构建的 OpenGL 的应用程序时,出现 GLX 错误:
$ /nix/store/p6fwy23nfcadxr4i780knajvmzga17aa-glxinfo-8.1.0/bin/glxinfo
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: r600
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 156 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 50
Current serial number in output stream: 49
答案1
在 Nix 中,mesa 已修补以在/run/opengl-driver
目录中搜索驱动程序。
安装 mesa-noglu:
$ nix-env -i mesa-noglu
并创建符号链接
$ sudo ln -s /nix/store/*-mesa-noglu-*-drivers /run/opengl-driver