stotko / stdgpu

stdgpu: Efficient STL-like Data Structures on the GPU
https://stotko.github.io/stdgpu/
Apache License 2.0
1.16k stars 83 forks source link

Solve compilation error in Ubuntu 22.04 and friends #337

Closed nachovizzo closed 1 year ago

nachovizzo commented 1 year ago

Amazing work! This is not a bug report, but just leaving it here in case someone needs this in the future

Problem

For those trying to compile this on Ubuntu 22.04 and friends alike, I managed to solve the following error:

/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
  435 |         function(_Functor&& __f)
      |                                              

The problem is that the default C++ compiler for Ubuntu 22.04 has a problem making friends with nvcc, more info on the related issues at the bottom

Solution

Install an older compiler and tell nvcc which is the host-compiler using CMake

sudo apt install g++10
cmake -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-10 -Bbuild

Related issues

newptcai commented 6 months ago

There is a typo. It should be g++-10