Skip to content

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

Description

@JamesGlare

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) 858509e
  • 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 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions