NVlabs / instant-ngp

Instant neural graphics primitives: lightning fast NeRF and more
https://nvlabs.github.io/instant-ngp
Other
16k stars 1.93k forks source link

Can't build testbed.cu:175:23: error: no match for ‘operator=' #1318

Open ra100 opened 1 year ago

ra100 commented 1 year ago

I'm getting this error while building:

instant-ngp/src/testbed.cu:175:23: error: no match for ‘operator=’ (operand types are ‘ngp::Testbed::Volume’ and ‘<brace-enclosed initializer list>’)
  175 |         m_volume = {};
      |                       ^

I'm on xubuntu 23.04,

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The CUDA compiler identification is NVIDIA 12.1.66
-- Found Vulkan: /usr/lib/x86_64-linux-gnu/libvulkan.so (found version "1.3.243") found components: glslc glslangValidator 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.11.2", minimum required is "3") 

When I change the line with error to:

m_volume = ngp::Testbed::Volume{};

it passes through this step, but then it fails in pybind11 on:

instant-ngp/dependencies/pybind11/include/pybind11/cast.h: In function ‘typename pybind11::detail::type_caster<typename pybind11::detail::intrinsic_type<T>::type>::cast_op_type<T> pybind11::detail::cast_op(make_caster<T>&)’:
instant-ngp/dependencies/pybind11/include/pybind11/cast.h:42:120: error: expected template-name before ‘<’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                        ^
instant-ngp/dependencies/pybind11/include/pybind11/cast.h:42:120: error: expected identifier before ‘<’ token
instant-ngp/dependencies/pybind11/include/pybind11/cast.h:42:123: error: expected primary-expression before ‘>’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |                                                                                                                           ^
instant-ngp/dependencies/pybind11/include/pybind11/cast.h:42:126: error: expected primary-expression before ‘)’ token
   42 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
      |  

And I have no idea what I can do with that.

ElJaviLuki commented 1 year ago

there was a build in this link https://github.com/NVlabs/instant-ngp/releases/download/continuous/Instant-NGP-for-RTX-2000.zip but I don't know why they removed it

ra100 commented 1 year ago

For now, I found a hack, I removed these lines from cast.h

template <typename T>
typename make_caster<T>::template cast_op_type<T> cast_op(make_caster<T> &caster) {
    return caster.operator typename make_caster<T>::template cast_op_type<T>();
}

it compiled, but have other issues, feels like being on a minefield :)

ra100 commented 1 year ago

there was a build in this link https://github.com/NVlabs/instant-ngp/releases/download/continuous/Instant-NGP-for-RTX-2000.zip but I don't know why they removed it

Thanks @ElJaviLuki, but that looks like a Windows build.

murez commented 1 year ago

this may be caused by gcc 12 / g++ 12, I am trying to use gcc 11

murez commented 1 year ago

and it works well.

actionless commented 1 year ago

@murez how did you specified, which of GCC versions to use in the build?

i've tried

rm -fr ./build
CXX=g++-11 CC=gcc-11 LD=g++-11 .......

and still having the same error on compilation

murez commented 1 year ago

Well, I have a preset json telling about compilers I want to use. So you can search for the cmake user presets

actionless commented 1 year ago

weird, i've checked the compilation log - and it actually detected right the version of GCC:

$ CXX=g++-11 CC=gcc-11 LD=g++-11 cmake . -B build
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
...

however fails still the same:

[ 61%] Building CUDA object CMakeFiles/ngp.dir/src/testbed.cu.o
/media/old_media/ai/instant-ngp/src/testbed.cu: In member function _void ngp::Testbed::set_mode(ngp::ETestbedMode)_:
/media/old_media/ai/instant-ngp/src/testbed.cu:175:23: error: no match for _operator=_ (operand types are _ngp::Testbed::Volume_ and _<brace-enclosed initializer list>_)
  175 |         m_volume = {};
      |                       ^
/media/old_media/ai/instant-ngp/include/neural-graphics-primitives/testbed.h:852:15: note: candidate: _ngp::Testbed::Volume& ngp::Testbed::Volume::operator=(ngp::Testbed::Volume&&)_
  852 |         struct Volume {
      |               ^~~~~~
/media/old_media/ai/instant-ngp/include/neural-graphics-primitives/testbed.h:852:15: note:   no known conversion for argument 1 from _<brace-enclosed initializer list>_ to _ngp::Testbed::Volume&&_
make[2]: *** [CMakeFiles/ngp.dir/build.make:299: CMakeFiles/ngp.dir/src/testbed.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:308: CMakeFiles/ngp.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
actionless commented 1 year ago

after further investigation i see that something in cuda runtime is passing down cicc --c++14 --gnu_version=130101 ..... during compilation, any ideas how to override gnu_version there?

murez commented 1 year ago

Could you please give some information about how you install your CUDA toolkit?

murez commented 1 year ago

Well, I have a preset json telling about compilers I want to use. So you can search for the cmake user presets

By the way, nvhpc@23.1 works well.

actionless commented 1 year ago

i was using cuda 12 from Arch repositories - and apparently it was also the problem, not only too new GCC - so i "solved" the problem by just using a Docker image

scivision commented 12 months ago

i see this problem with GCC 12.2, Cuda 12.2 and instant-ngp commit 9f6ab886