-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
libGL not working on non-NixOS (without setting up) #9415
Comments
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. |
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 |
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) |
You can easily use |
couldn't we require a nixpkgs config setting to be set and wrap all |
@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. |
I'm saying we could use nixpkgs config to set |
To a non-technical user, what would the correct (current) procedure look like for installing |
After talking about this with @ttuegel for a while, we've established that the following works:
This 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. |
What does this give beyond what the simpler |
@bjornfor You'd only load the system |
Good point :-) |
What about |
That wouldn't work because of libGL dependencies:
It'd only look in the Nix store, since Nix uses a custom |
I see. I'm going to stop suggesting alternatives now :-) |
I tried this according to the instructions of joepie91 above, since I wanted to use OpenSCAD from Nix on Debian Jessie with Intel HD graphics (Haswell). Copying/patching The contents of my ~/.nix-libs is now:
Commands used:
How to find out which libraries are required in ~/.nix_libs for some program:
By the way, glxinfo still aborts with |
|
Since I only call some OpenGL-needing-programs with
(But I've removed libz now, since strangely it now works without ~/.nix_libs/libz.so.1 after uninstalling and reinstalling...)
Unfortunately, the i965_dri.so is only searched in the wrong places, so I had to copy it to
Yes, but neither ldd nor LD_DEBUG helped here, since they did not show the missing libraries. |
That part is a very good solution, I think, except symlink should be better than copy (due to your OS updates).
Hmm, then I suppose these are also cases using |
I just ran into a similar issue trying to get nix's blender running on Fedora: blender wouldn't find
|
i can reproduce it on elementary OS Freya (based on Ubuntu 14.04 LTS). i copied the systems libGL.so and patched it, then openarena works.
|
It still seems rather inconvenient that one needs to do update libGL by hand (after the host OS updates). |
I'm actually having the same issue on NixOS 23.05 with nixpkgs unstable; for some reason the libGL.so.* and libEGL.so.* files don't exist in the opengl lib paths at all! The ones I have are for mesa and nvidia. How do I get the generic ones? |
There are no universal ones, I believe. I mean, nowhere, not just on NixOS. |
I was meaning in particular those missing libGL.so./libEGL.so. files, is there a way to get those installed onto NixOS? I got a couple of packages (gamemode in particular) screaming that they can't run because of the missing libGL.so.1 and libEGL.so.1 files |
This github issue is about non-NixOS. Speaking of games on NixOS, my first guess is that you're missing |
Yeah but I also saw some mention that the issue also occurs on NixOS aswell, was what caught my attention. And I actually do have all of the options for opengl enabled
|
@NovaViper that is because What does have the special code are the |
I did this interesting zig program that runs compiled mach-engine binary If distros provided this kind of mapping |
No, I'm quite sure it won't work as easily. The libraries like libGL that you find on the OS are not stand-alone. They link against other libraries (libc, usually libstdc++ and others). Your application typically also uses libc, libstdc++ etc. but sometimes it was built against incompatible versions of them, so when you load everything together, you're unable to choose a set of libraries satisfying both your app and libGL. |
The typical .so's that games and such loads talk with C ABI which are binary compatible. C++ libs are different thing, but programs usually don't try to load those externally. Of course libc structures being passed over DLL boundaries can be problematic. |
We get issues even with glibc on NixOS, as it's only compatible in a single way (upgrading, not downgrading). Other C libraries are even worse, e.g. libwayland IIRC. |
I'm not proud of this workaround, but if:
... then you can do something horrible and impure like:
This wraps Problems with this approach:
I'm happy to hear of simpler/more robust approaches to using the host's QEMU, while still using |
I'm in the process of packaging libcapsule, which might just be suitable. |
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 |
Libcapsule indeed was a promising route attempted years ago. Hopefully it will go better now than back then. I see it got recent commits. 🤞🏽 |
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 |
We were trying to do that here and just ran into this issue. |
Installation works, running it does not.
The text was updated successfully, but these errors were encountered: