LuxCoreRender / BlendLuxCore

Blender Integration for LuxCore
GNU General Public License v3.0
726 stars 91 forks source link

Linux: failed to open libnvrtc-builtins.so. #535

Closed menoos closed 3 years ago

menoos commented 4 years ago

Environment: Linux, Manjaro (latest) GPU Nvidia RTX2080TI, Driver 440.100 Blender 2.83.3 LuxCore 2.5 alpha0

Steps to reproduce:

  1. Have a default cube scene
  2. Set GPU API to CUDA and Film Device to GPU
  3. Activate rendered view

Actual Result: A "MergeSampleBuffersOCL CUDA program compilation error" is displayed. Note: rendering on CPU with both CUDA and OPENCL works fine. log.txt Screencast_CUDAerror

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/92228463-linux-failed-to-open-libnvrtc-builtins-so?utm_campaign=plugin&utm_content=tracker%2F80143047&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F80143047&utm_medium=issues&utm_source=github).
Dade916 commented 4 years ago

The problem is here:

[LuxRays][82.053] [MergeSampleBuffersOCL] CUDA program compilation error: 
nvrtc: error: failed to open libnvrtc-builtins.so.
  Make sure that libnvrtc-builtins.so is installed correctly.
Traceback (most recent call last):
  File "/home/user/.config/blender/2.83/scripts/addons/BlendLuxCore/engine/base.py", line 123, in view_draw
    viewport.view_draw(self, context, depsgraph)
  File "/home/user/.config/blender/2.83/scripts/addons/BlendLuxCore/engine/viewport.py", line 221, in view_draw
    framebuffer.update(engine.session, scene)
  File "/home/user/.config/blender/2.83/scripts/addons/BlendLuxCore/draw/viewport.py", line 229, in update
    luxcore_session.GetFilm().GetOutputFloat(self._output_type, self.buffer)

BlendLuxCore is unable to find a library of NVIDIA runtime compiler (i.e. NVRTC). I should have fixed the problem with the patch listed above so the next automatic v2.5alpha0 build should work.

Dade916 commented 4 years ago

Side note, if you install NVIDIA 450+ drivers, you will able to use hardware RTX acceleration and Optix denoiser:

[LuxRays][81.786] CUDA support: enabled
[LuxRays][81.786] CUDA support: available
[LuxRays][81.786] CUDA driver version: 10.20
[LuxRays][81.786] CUDA device count: 1
[LuxRays][81.786] Optix support: not available

Optix is not currently available and enabled in your installation.

Theverat commented 4 years ago

Thanks for the fix!

Theverat commented 4 years ago

Unfortunately, it looks like the fix is not working on my system (Ubuntu 20.04 with Nvidia driver 450.57). I still get the same error:

nvrtc: error: failed to open libnvrtc-builtins.so.
  Make sure that libnvrtc-builtins.so is installed correctly.
menoos commented 4 years ago

Just checked and I get the same error.

Dade916 commented 4 years ago

Unfortunately, it looks like the fix is not working on my system (Ubuntu 20.04 with Nvidia driver 450.57). I still get the same error:

nvrtc: error: failed to open libnvrtc-builtins.so.
  Make sure that libnvrtc-builtins.so is installed correctly.

Well, it is Python and BlendLuxCore, check why the code it isn't work on your system, does LoadLibrary call fails ? What paths are printed at the start ? The patch was linked above: https://github.com/LuxCoreRender/BlendLuxCore/commit/e92b73646e745926ea1c27d34613967588ad5830

Theverat commented 4 years ago

I think this is the answer: https://stackoverflow.com/a/4326241

To avoid having to set LD_LIBRARY_PATH, you modify the rpath entry in the .so files. On Linux, there are two utilities I found that do this: chrpath, and patchelf. chrpath is available from the Ubuntu repositories. It cannot change rpath on .so's that never had one. patchelf is more flexible.

patchelf --set-rpath ./ somelib.so did the trick in fixing somelib.so that loads anotherlib.so that resides in the same path

I ran

patchelf --set-rpath ./ libnvrtc.so
patchelf --set-rpath ./ libnvrtc-builtins.so

and now it's rendering fine with OptiX. I guess the best place to do this is the packaging script (maybe even the LuxCore standalone packaging script?).

Theverat commented 4 years ago

@menoos It should work now, can you test the latest daily build and report back if it's fine?

menoos commented 4 years ago

I did a fresh install of Blender to be sure that I didn't mess the plugin installation, but I get the same output. Is there anything on top of console logs that I can do to make debugging easier? I'm not a power-user, but I can try.

Theverat commented 4 years ago

@meenos You don't need to provide any logs, I know the solution, I probably just forgot to add it to some packaging script.

Theverat commented 4 years ago

I'm at a loss a bit. I inserted the fix here: https://github.com/LuxCoreRender/LinuxCompile/blob/master/nvrtc-install.sh But looking at the azure output, an old version of this script is still used, and I don't know where/how to update it.

Dade916 commented 4 years ago

For some reason, there were two copies of nvrtc-install.sh and you edited the one unused. The correct one was in distfiles directory. I should have fixed the problem and a new build is undergoing.

Dade916 commented 4 years ago

The new builds are up.

menoos commented 4 years ago

No difference with the new build. What has changed though, is that now selecting CUDA as GPU API makes my GPU selected automatically. With previous builds, after selecting CUDA, my GPU was not available. I had to restart Blender to make it show up, and select it manually.

DiracSea3921 commented 3 years ago

I have the same problem on the latest master branch. Is this issue solved or not? I tried patchelf command but it doesn't work.

Theverat commented 3 years ago

@DiracSea3921 Did you download the latest build from the release section? https://github.com/LuxCoreRender/BlendLuxCore/releases

Is this issue solved or not?

It is solved, I forgot to close it. If your problems persist with a build from the release section, please open a new issue with more details about the steps you've taken.

johannes-wilde commented 3 years ago

I still have this issue with the latest Build for Linux. I am running PopOs 20.10 with Nvidia Driver 460.39 on an 2080ti

menoos commented 3 years ago

The same system and driver as Johannes, checked on 2080TI and 3090. The issue still occurs with 2.5RC1.

johannes-wilde commented 3 years ago

The same system and driver as Johannes, checked on 2080TI and 3090. The issue still occurs with 2.5RC1.

Copy all files containing "libnvrtc" from home/.config/blender/yourblenderversion/scripts/addons/BlendLuxCore/bin to /usr/lib Restart your PC. That should work.

menoos commented 3 years ago

Thanks Johannes, that worked.

bogatkaj commented 1 year ago

@Theverat Please add this to the wiki!

I searched the web for hours before I found this issue, which solves the problem for me