instant-ngp icon indicating copy to clipboard operation
instant-ngp copied to clipboard

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

Open ra100 opened this issue 2 years ago • 13 comments

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.

ra100 avatar Apr 06 '23 17:04 ra100

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

ElJaviLuki avatar Apr 06 '23 18:04 ElJaviLuki

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 avatar Apr 06 '23 18:04 ra100

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.

ra100 avatar Apr 06 '23 18:04 ra100

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

murez avatar May 02 '23 05:05 murez

and it works well.

murez avatar May 02 '23 06:05 murez

@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

actionless avatar May 10 '23 07:05 actionless

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

murez avatar May 10 '23 13:05 murez

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 avatar May 10 '23 13:05 actionless

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?

actionless avatar May 10 '23 14:05 actionless

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

murez avatar May 22 '23 09:05 murez

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, [email protected] works well.

murez avatar May 22 '23 09:05 murez

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

actionless avatar May 22 '23 10:05 actionless

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

scivision avatar Nov 10 '23 03:11 scivision