Repository navigation
Open
Labels
0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: non-nixosRunning packages on non-NixOS Linux
Description
- Package: openarena
- Error: /nix/store/q8smn7k0y349ymfc9mdnja0wa6s79njv-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
- Platform: openSUSE 13.1, x86_64, XFCE
- Version: nix-env (Nix) 1.9
Installation works, running it does not.
sven@linux-etoq:~> nix-env -i openarena
installing ‘openarena-0.8.8’
these paths will be fetched (390.19 MiB download, 426.80 MiB unpacked):
/nix/store/q8smn7k0y349ymfc9mdnja0wa6s79njv-openarena-0.8.8
fetching path ‘/nix/store/q8smn7k0y349ymfc9mdnja0wa6s79njv-openarena-0.8.8’...
*** Downloading ‘https://cache.nixos.org/nar/194liswh0vgrj02q7q7ww8igizn45bri6ip4m5wxa47s3ghj65q7.nar.xz’ to ‘/nix/store/q8smn7k0y349ymfc9mdnja0wa6s79njv-openarena-0.8.8’...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 390M 100 390M 0 0 7996k 0 0:00:49 0:00:49 --:--:-- 9247k
building path(s) ‘/nix/store/j0lc0hns2kna9sw1g3k46zbazxhsxha0-user-environment’
sven@linux-etoq:~> openarena
/nix/store/q8smn7k0y349ymfc9mdnja0wa6s79njv-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
Reacted by Jeremy Schlatter, pinage404, Ignacio Tartavull, Rafed Ramzi, Bob, Xavier Groleau, Sam A. Horvath-Hunt, Etienne Laurin, Jules Lamur, Abdulla Abdurakhmanov and 40 more
Reacted by Adrien FAURE, Nicolas Mattia, David A Roberts, Nikolai Wuttke, Josef Kemetmüller, Travis Whitaker, aplaice, Jonas Schievink, xbreak, Aaron Janse and 20 more
Metadata
Metadata
Assignees
Labels
0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: non-nixosRunning packages on non-NixOS Linux
Activity
bjornfor commentedon Aug 24, 2015
Tricky... I wonder if it can be fixed binding openarena to mesa libGL. Then you'd at least have something that runs, although not necessarily optimally for your system.
On NixOS, programs find the selected/best OpenGL implementation here:
Something similar can of course be done with nixpkgs programs on non-NixOS (manually set $LD_LIBRARY_PATH).
CC @vcunat.
vcunat commentedon Aug 24, 2015
There's a deliberate choice to be impure in this respect, as I view libGL* as a part of your GPU driver. I expect using your system one is better even for apps that don't report an error (most do link against our version from mesa).
If one is able, the safest approach on non-nixos should be to actually create
/run/opengl-driver/lib(speaking of x86_64-linux) and put symlinks to your systemlibGL*. Alternatively one could just set$LD_LIBRARY_PATHto the location, but beware if it contains too many other libs...joepie91 commentedon Aug 24, 2015
Hmm. Would this not be a good usecase for parameters (letting you pick between a system libGL* path or a mesa dependency)? Or can those not be specified from the command-line?
(I'm still pretty new to Nix)
vcunat commentedon Aug 24, 2015
You can easily use
$LD_LIBRARY_PATHto open any libGL version. I've only seen one person who wanted to use the bundled mesa instead of system libGL (and on NixOS it's often the same one).domenkozar commentedon Sep 4, 2015
couldn't we require a nixpkgs config setting to be set and wrap all
libGLsoftware with it? that way users would get a message how/where to set the settingvcunat commentedon Sep 4, 2015
@domenkozar: I don't understand what you mean. Note that the problems only happen on non-nixos, and different distros have libGL on different locations, I think.
domenkozar commentedon Sep 4, 2015
I'm saying we could use nixpkgs config to set
$LD_LIBRARY_PATHfor non-nixos usersjoepie91 commentedon Sep 9, 2015
To a non-technical user, what would the correct (current) procedure look like for installing
openarenaon a non-NixOS distribution? I'm technical, but I don't know much about compiler toolchains, so an ELI5-style explanation might be the best way to make sense of this.joepie91 commentedon Sep 11, 2015
After talking about this with @ttuegel for a while, we've established that the following works:
nix-env -i patchelf)libGL.so.1(usually in/usr/lib64) somewhere, eg.~/.libgl-shim/libGL.so.1.patchelf --set-rpath /lib:/usr/lib:/lib64:/usr/lib64 ~/.libgl-shim/libGL.so.1(adjustlibpaths if necessary for your distribution)libGL.so.*symlinks that your system has, but in your~/.libgl-shim, and pointing to your modified copy.openarenaas follows:LD_LIBRARY_PATH=~/.libgl-shim openarenaThis approach also seems automatable, and should work for other things that use makeWrapper :)
I'm still working on something, but once I've gotten further with that, I'll probably do a proper writeup of this on my blog or something.
bjornfor commentedon Sep 11, 2015
What does this give beyond what the simpler
LD_LIBRARY_PATH=/usr/lib64 openarenaprovides (substitute for whatever path libGL.so.1 has on your system)? It seems you still need to provide the custom path to libGL, which cannot be automated.joepie91 commentedon Sep 11, 2015
@bjornfor You'd only load the system
libGL, and the rest of the dependencies would remain the pure Nix variants.bjornfor commentedon Sep 11, 2015
Good point :-)
bjornfor commentedon Sep 12, 2015
What about
LD_PRELOAD=/lib/libGL.so.1 openarenathen?148 remaining items
arximboldi commentedon Aug 26, 2024
Uhhhh, skimming through the README and some videos... this looks so interesting! Do you have some idea of how it could be used specifically to solve the libGL problem?
I am starting to dream of a plausible not so far future where we can use Nix to create portable
.appimagefor graphical applications... That would be really such a dream...vcunat commentedon Aug 28, 2024
Libcapsule indeed was a promising route attempted years ago. Hopefully it will go better now than back then. I see it got recent commits. 🤞🏽
Pandapip1 commentedon Aug 28, 2024
It's funny you should mention that use case. That's literally my use case as well!
As I understand it, what libcapsule attempts to do is to create a library that at runtime, tries to use the system linker to find the actual libraries and expose them: https://people.collabora.com/~vivek/libcapsule.pdf
Thus far, I've managed to package libcapsule as well as make a simple builder to make libcapsule-wrapped libraries. The libcapsule derivation seems to be working fine, but something still needs to be fixed with the wrapper. I think I'm now at a point where it makes sense to draft a PR; I'll link that here: #337995
Samueru-sama commentedon Sep 7, 2024
We were trying to do that here and just ran into this issue.
georgyo commentedon Dec 21, 2024
If you are like me, and just want to replicate what nixos does to create /run/opengl-driver on non-nixos systems then all you need to do is the following. No need to have special environment variables or namespaces.
For
IntelorAMDgraphics cards, do the following. There is no need for special AMD drivers any moreFor
Nvidia, you need to do a little more work, since you need multiple thingsFirst create
opengl-dir.nixThen link it into place.
Atemu commentedon Dec 22, 2024
Note that you will have to do that on every boot and need to refresh it whenever you update your Nixpkgs.
Modify packages
Modify packages
arximboldi commentedon Apr 22, 2025
@Pandapip1, @Samueru-sama , did any of you manage to get graphical applications bundled as AppImage's using Nix?
Samueru-sama commentedon Apr 22, 2025
We gave up and are now using sharun and runimage
exzombie commentedon Sep 29, 2025
Being quite unhappy with how NixGL causes issues with symbol version conflicts, I made a package that creates
/run/opengl-driverson non-nixos systems. You need to build it using the same nixpkgs that you are using for your packages, which I plan to make easier by providing integration with Home Manager. For now, I'd like to collect some feedback on what you think about this approach. Thanks to @georgyo for the idea!exzombie commentedon Oct 26, 2025
As a followup, I have now opened a Home Manager PR. It helps ensure that the drivers at
/run/opengl-driversare kept up to date. I would really appreciate it if HM users have some time to try it out and report if it covers their use cases.