mitsuba2 icon indicating copy to clipboard operation
mitsuba2 copied to clipboard

[🔨 compilation issue] Compilation on WSL2 fails with cuda linker error

Open JamesGlare opened this issue 2 years ago • 3 comments

Summary

Compilation stops on WSL2 with /usr/bin/ld: cannot find -lcuda

System configuration

  • Platform: Windows 11/WSL2 (Ubuntu 20.04.4 LTS) + CUDA 11.4
  • Compiler: GCC9.4
  • Python version: 3.9.7 (anaconda)
  • Mitsuba 2 version: (last commit sha) 858509e6
  • Compiled variants:
    • scalar_rgb
    • gpu_autodiff_mono

Description

I am trying to figure out if mitsuba2 builds on WSL2 with CUDA11 support. Compilation stops with this error: [ 35%] Linking CXX shared library libmitsuba-core.so /usr/bin/ld: cannot find -lcuda collect2: error: ld returned 1 exit status

I am not 100% sure what the issue is, but it might be because libcuda is in /usr/lib/wsl/lib in WSL. I tried adding that path to $LD_LIBRARY_FLAGS without success.

I supplied nvcc path via CMAKE flag or CUDACXX env variable.

Steps to reproduce

On WSL2, CUDA-11.4, do mkdir build && cd build cmake -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. cmake --build .

JamesGlare avatar Mar 27 '22 14:03 JamesGlare

Hi @JamesGlare,

We haven't experimented much with WSL2 on our side. If IIRC @bathal1 did give this a shot at some point, maybe he will be able to help you with this.

Speierers avatar Apr 04 '22 07:04 Speierers

Hi, getting it to compile is possible if you link the CUDA libs correctly but you won't be able to use the GPU variants anyway, since the NVIDIA driver that enables CUDA applications to run in WSL2 is lacking OptiX support as of now. Cheers.

Arcanous98 avatar May 27 '22 10:05 Arcanous98

Hi, in case anyone bumps into this -> NVIDIA still doesn't support OptiX. Here's the thread that might be updated once they do: Optix for WSL Thread

jmoraispk avatar Aug 01 '23 00:08 jmoraispk