Skip to content
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

error: parameter packs not expanded with ‘...’ #119

Closed
duckworthd opened this issue Feb 7, 2022 · 15 comments
Closed

error: parameter packs not expanded with ‘...’ #119

duckworthd opened this issue Feb 7, 2022 · 15 comments

Comments

@duckworthd
Copy link

duckworthd commented Feb 7, 2022

I suspect this issue is not directly related to instant-ngp's code, but I'll post it here all the same in case anyone else sees a similar issue.

TL;DR there's an issue compiling std_function.h, a dependency of tiny-cuda-nn.

> cmake --build build --config RelWithDebInfo

Consolidate compiler generated dependencies of target tiny-cuda-nn
[  1%] Building CUDA object dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common.cu.o
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
  435 |         function(_Functor&& __f)
      |                                                                                                                                                 ^
/usr/include/c++/11/bits/std_function.h:435:145: note:         ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
  530 |         operator=(_Functor&& __f)
      |                                                                                                                                                  ^
/usr/include/c++/11/bits/std_function.h:530:146: note:         ‘_ArgTypes’
gmake[2]: *** [dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/build.make:76: dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/common.cu.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:306: dependencies/tiny-cuda-nn/src/CMakeFiles/tiny-cuda-nn.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

Here's a bit more info on my setup. I'm using CUDA v11.4.4 and GCC v.11.2.0 on Debian. I saw an identical issue when compiling with CUDA v11.6.0.

> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_Oct_11_21:27:02_PDT_2021
Cuda compilation tools, release 11.4, V11.4.152
Build cuda_11.4.r11.4/compiler.30521435_0

> gcc --version
gcc (Debian 11.2.0-13) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Any tips appreciated!

@krasin
Copy link

krasin commented Feb 7, 2022

Just as a data point, I don't have this problem and my compiler versions are:

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:16:03_PST_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0
$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Note that my GCC version is much older (since I test it on Ubuntu 20.04), while nvcc is from 11.6. Not sure, if that's relevant.

@krasin
Copy link

krasin commented Feb 7, 2022

I got curious and tried it with gcc-11/g++-11:

$ mkdir build
$ cd build
$ CC=gcc-11 CXX=g++-11 cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo  ..
-- The CXX compiler identification is GNU 11.1.0                                                                                                                                                           
-- The CUDA compiler identification is NVIDIA 11.6.55
...
$ ninja
...

It succeeded.

There must be something else in that Debian environment that makes it wrong.

@duckworthd
Copy link
Author

A colleague identified the issue as originating from gcc. Using an older build of GCC (GCC v10.3.1, to be precise) solved my issue.

$ sudo apt install gcc-10 g++-10
$ export CC=/usr/bin/gcc-10
$ export CXX=/usr/bin/g++-10
$ export CUDA_ROOT=/usr/local/cuda
$ ln -s /usr/bin/gcc-10 $CUDA_ROOT/bin/gcc
$ ln -s /usr/bin/g++-10 $CUDA_ROOT/bin/g++
(Build Instant-NGP as described)

@geoeo
Copy link

geoeo commented Apr 30, 2022

This has reappeared on ubuntu jammy. Default (Aptitude) gcc is 11.2 and cuda version is 11.6.

This is also not fixed with downgrading to gcc-10

The problem is that the aptitude version is cuda toolkit version is 11.5.
When 11.6 is used then this is fixed!
Currently you have to download the toolkit via the ubuntu 20.04 runfile
Then install via sudo sh cuda_11.6.2_510.47.03_linux.run --toolkit --silent --override
Also set your environment flags appropriately.

For me this fixed the issue. I guess the aptitude version should be upgraded!

@sherwoac
Copy link

A colleague identified the issue as originating from gcc. Using an older build of GCC (GCC v10.3.1, to be precise) solved my issue.

$ sudo apt install gcc-10 g++-10
$ export CC=/usr/bin/gcc-10
$ export CXX=/usr/bin/g++-10
$ export CUDA_ROOT=/usr/local/cuda
$ ln -s /usr/bin/gcc-10 $CUDA_ROOT/bin/gcc
$ ln -s /usr/bin/g++-10 $CUDA_ROOT/bin/g++
(Build Instant-NGP as described)

Switching to gcc/g++-10 worked for me too. The healthy way to do this is to use update-alternatives and set the default to gcc/++-10 for the build.

@vikasTmz
Copy link

vikasTmz commented Sep 6, 2022

A colleague identified the issue as originating from gcc. Using an older build of GCC (GCC v10.3.1, to be precise) solved my issue.

$ sudo apt install gcc-10 g++-10
$ export CC=/usr/bin/gcc-10
$ export CXX=/usr/bin/g++-10
$ export CUDA_ROOT=/usr/local/cuda
$ ln -s /usr/bin/gcc-10 $CUDA_ROOT/bin/gcc
$ ln -s /usr/bin/g++-10 $CUDA_ROOT/bin/g++
(Build Instant-NGP as described)

This worked for me as well.

Specs
Ubuntu: 22.04.1 LTS
GPU: Quadro P6000
CUDA version: 11.6

original GCC/G++ version == 11.2 did not work. Downgraded to 10 and it worked.

@lucasjinreal
Copy link

Why the solution is change gcc not change code?
change g++10 not work for me, but the code can be changed to support more decent gccs

@javl
Copy link

javl commented Nov 10, 2022

@jinfagang Do you have an example of what to change for this to work?

@edtechchrward
Copy link

Apparently, this is a C++ syntax problem that has been around for some time - as instanced in this post dated 2015:
https://cplusplus.com/forum/beginner/156793/
It was supposed to have been fixed for gcc 12.0 in 2022:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102104
But apparently the bug is still around and causing problems in 2023.

How do I tell the system to build instant-ngp with g++-12 and gcc-12 instead of versions 11?

@edavalosanaya
Copy link

edavalosanaya commented Aug 25, 2023

Using the approach recommended by this fixed my issue.

Specs:
Ubuntu 22.04 LTS
nvcc: 11.5
GPU: RTX 3080

@pullitdown
Copy link

pullitdown commented Aug 30, 2023

my device rtx3060 capability 8.6 cudatoolkit 11.5 gcc 11
i fixed use command below
sudo apt install gcc-10 g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

@felipebutcher
Copy link

my device rtx3060 capability 8.6 cudatoolkit 11.5 gcc 11 i fixed use command below sudo apt install gcc-10 g++-10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 sudo update-alternatives --config gcc sudo update-alternatives --config g++

@pullitdown this worked for me, thx. ubuntu 22 with 3060 laptop

@kungfooman
Copy link

I did what @pullitdown said, but still couldn't get it to compile, so I did:

apt purge gcc-11
apt purge g++-11

But it still didn't compile and for some reason c++ still referenced version 11 files:

data@datapc:~$ c++ -v 
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/lib/cuda, version 11.5

Finally resolved via: sudo rm /usr/bin/../lib/gcc/x86_64-linux-gnu/11 -r

(now it just finally seemed to compile... but proceed with caution when doing rm)

@JzHuai0108
Copy link

Drawing inspirations from @edavalosanaya and the referenced issue, and the stackoverflow question about using gcc in pip command,
I fixed the problem like this,

sudo apt install g++-10
CXX=g++-10 CC=gcc-10 LD=g++-10 pip install <submodules/simple-knn:the module name>

@drzraf
Copy link

drzraf commented Aug 30, 2024

On Ubuntu 22.04, gcc-9 (9.5) could compiles while gcc-11 (11.4) presents OP syntax problem.
gcc-12 is unsupported: the build process fails with an error message, as does gcc-9 unless ...-allow-unsupported-compiler is passed too. Not all versions of nvcc appear to support NVCC_CCBIN (or not consistently), so relying on -ccbin is the safest option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests