-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
Hardware acceleration does not work without LD_LIBRARY_PATH hacks #454
Comments
/usr/lib/wsl/lib is symlinked into /run/opengl-driver/lib Can you run the same commands with strace to see if it searches the right directories? |
Here is the output of I can see many references to |
It is not searching for d3d12 in the right location.
|
hmm, libd3d12.so does exist in my nix store in from the wsl-lib and opengl-drivers packages:
I'm a good bit out of my depth here, but is there a way to add these packages as runtime dependencies for the mesa package? Setting any of these directories as the LD_LIBRARY_PATH does allow at least the Nvidia d3d12 adapter to work |
Thank you, you have given my enough information to discover the For |
Alright, for a minimal configuration.nix only snippet, I have the following:
The libedit package only proides libedit.so.5 and libedit.so.0. d3d12 is looking for .2, so for the time being, this will work around that. It seems to pull in all of the other required library files as well. |
how do i get my nvidia gpu to work |
It seems that the option |
@Parsifa1 Replace with
@SuperSandro2000, what do you think about adding this to the repo by default, particularly since this easier option is removed now? It is still needed on my system for my GPU to function, and I also don't think it would cause anyone else any issues. I would be happy to submit a PR with more documentation and explanation if you think that would be proper. Perhaps we could even add options to enable the other paths I have had to added for Cuda and whatnot to work. Below is the full environment section I have been using now:
|
LD_LIBRARY_PATH is a big foot gun and can easily cause weird and hard to debug loading errors. I would love to really avoid it. If it is necessary we can add an option for it but I wouldn't turn it on by default. The extra variables seem to be very user specific. I don't think they are a good fit. |
Maybe something like |
I have actually tried this and it does not really change anything. As to Sandro's comments, Everything other than "/run/opengl-driver/lib" is for the windows/wsl nvidia drivers to work, and to support cuda properly. It would be better to include the two pkgs additions in another way, like symlinking them into the same opengl lib folder so they don't end up effecting other parts of the system, but I was not able to get that to work. |
No, I mean having an utility like |
@SuperSandro2000 you said:
I'm having the same ENOENT errors in strace when I launch emacs. I just installed NixOS on WSL in the past week or so, just trying to set everything up. You also said:
but on my system, /usr/lib/wsl/lib is not symlinked. It contains all the cuda and d3d12 library files. And I apparently have no /run/opengl-driver/lib directory. |
You may have to reboot your wsl system to get the run folder back. For some reason mine is still unreliable, particularly after a laptop sleep. But I have been looking more into exactly what files are needed to be linked into to keep WSLg happy, without causing any ld hack issues. To settle onto a "perfect solution" I'm considering trying changing the symlink from wsl/lib into a copy and elfpatch instead. I've had some success doing this manually now, but have not had the time to properly add it to the repo config and try it out. |
wsl --shutdown wasn't doing it, but a reboot of the machine, did bring back the /run/opengl-driver/lib/ directory. |
Are you setting this? NixOS-WSL/modules/wsl-distro.nix Line 77 in 0bec2bf
|
No! Seems quite important. I only read the documentation, I should have read the code. I will give that a go. |
Trying to get this working on AMD graphics. I have dual AMD/Nvidia. Nvidia is fine with the fixes here. |
To fix it for radeon, I had to add the following to my configuration.nix environment.sessionVariables = { For some reason it requires libssl.so.3 to have radeon work. I wonder if this couldn't be done in a better way though. |
Bug description
At this time, the WSL2/WSLg D3D12 hardware acceleration does not work out of the box due to library problems, even though the mesa.drivers package does have D3D12 support enabled by default.
I do not understand exactly what is going on. but there are a few ways to set LD_LIBRARY_PATH as a hack to fix it:
LD_LIBRARY_PATH=/run/opengl-driver/lib
works withMESA_D3D12_DEFAULT_ADAPTER_NAME=Nvidia
but notIntel
(My laptop has two GPUs)LD_LIBRARY_PATH=ub:/run/opengl-driver/lib
works with bothIntel
andNvidia
from above, where theub
folder has some basic library files copied from the WSL2 Ubuntu system - see below for contentsIn both examples above,
/run/opengl-driver/lib
can be swapped with/usr/lib/wsl/lib
. I'm not sure what the difference is here, other than that/usr/lib/wsl/lib
has many more files.I believe this could be two problems:
To Reproduce
With the following config:
Then run any of the following commands:
The ub folder I am using is: ub.tar.gz
Logs
Example of hardware acceleration working:
What happens without the LD_LIBRARY_PATH hack:
Where the ub folder has the following files:
WSL version
The text was updated successfully, but these errors were encountered: