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: ‘result_of_t’ is not a member of ‘std’ #116

Closed
Songlin1998 opened this issue Feb 6, 2022 · 10 comments
Closed

error: ‘result_of_t’ is not a member of ‘std’ #116

Songlin1998 opened this issue Feb 6, 2022 · 10 comments

Comments

@Songlin1998
Copy link

hi!
When I input 'instant-ngp$ cmake --build build --config RelWithDebInfo -j 16', the Cmake compiling process ended with error ‘result_of_t’ is not a member of ‘std’.

The version of gcc is 8.3.1, and my environment meets the requirements. I guess such error is still related to the environment.

Here are the details:

-- Using X11 for window creation
-- !!! Warning OptiX_INSTALL_DIR not set in environment. using default
-- OptiX_INSTALL_DIR value: /usr/local/NVIDIA-OptiX-SDK-7.3.0-linux64-x86_64
-- OptiX headers (optix.h and friends) not found.
CMake Warning at CMakeLists.txt:170 (message):
OptiX was not found. Neural graphics primitives will still compile and run
correctly. However, SDF training in 'raystab' and 'pathescape' modes will
be significantly slower.

-- pybind11 v2.7.1
-- Targeting GPU architectures: 75;75;75;75;75;75;75;75;75;75
-- Configuring done
-- Generating done
-- Build files have been written to: /hd4/yangsonglin/instant-ngp/build
Consolidate compiler generated dependencies of target glfw_objects
Consolidate compiler generated dependencies of target tiny-cuda-nn
[ 29%] Built target glfw_objects
[ 50%] Built target tiny-cuda-nn
Consolidate compiler generated dependencies of target ngp
[ 52%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui.cpp.o
[ 56%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_tables.cpp.o
[ 56%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_impl_glfw.cpp.o
[ 60%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/ImGuizmo.cpp.o
[ 60%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_impl_opengl3.cpp.o
[ 61%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_draw.cpp.o
[ 63%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_widgets.cpp.o
[ 65%] Building CUDA object CMakeFiles/ngp.dir/src/marching_cubes.cu.o
[ 67%] Building CUDA object CMakeFiles/ngp.dir/src/camera_path.cu.o
[ 69%] Building CUDA object CMakeFiles/ngp.dir/src/common_device.cu.o
[ 70%] Building CUDA object CMakeFiles/ngp.dir/src/render_buffer.cu.o
[ 74%] Building CUDA object CMakeFiles/ngp.dir/src/testbed.cu.o
[ 74%] Building CUDA object CMakeFiles/ngp.dir/src/nerf_loader.cu.o
[ 76%] Building CUDA object CMakeFiles/ngp.dir/src/testbed_image.cu.o
[ 78%] Building CUDA object CMakeFiles/ngp.dir/src/testbed_sdf.cu.o
[ 80%] Building CUDA object CMakeFiles/ngp.dir/src/testbed_nerf.cu.o
[ 81%] Building CUDA object CMakeFiles/ngp.dir/src/testbed_volume.cu.o
[ 83%] Building CXX object CMakeFiles/ngp.dir/src/thread_pool.cpp.o
[ 85%] Building CUDA object CMakeFiles/ngp.dir/src/tinyexr_wrapper.cu.o
In file included from /hd4/yangsonglin/instant-ngp/src/thread_pool.cpp:15:0:
/hd4/yangsonglin/instant-ngp/include/neural-graphics-primitives/thread_pool.h:44:71: error: ‘result_of_t’ is not a member of ‘std’
auto enqueueTask(F&& f, bool highPriority = false) -> std::future<std::result_of_t<F()>> {
^
/hd4/yangsonglin/instant-ngp/include/neural-graphics-primitives/thread_pool.h:44:71: error: ‘result_of_t’ is not a member of ‘std’
/hd4/yangsonglin/instant-ngp/include/neural-graphics-primitives/thread_pool.h:44:90: error: type/value mismatch at argument 1 in template parameter list for ‘template class std::future’
auto enqueueTask(F&& f, bool highPriority = false) -> std::future<std::result_of_t<F()>> {
^
/hd4/yangsonglin/instant-ngp/include/neural-graphics-primitives/thread_pool.h:44:90: error: expected a type, got ‘( < F())’
/hd4/yangsonglin/instant-ngp/include/neural-graphics-primitives/thread_pool.h:44:91: error: expected initializer before ‘>’ token
auto enqueueTask(F&& f, bool highPriority = false) -> std::future<std::result_of_t<F()>> {
^
[ 87%] Building CXX object CMakeFiles/ngp.dir/src/tinyobj_loader_wrapper.cpp.o
gmake[2]: *** [CMakeFiles/ngp.dir/src/thread_pool.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/ngp.dir/all] Error 2
gmake: *** [all] Error 2

@pwais
Copy link
Contributor

pwais commented Feb 6, 2022

what version of libc++ do you have? maybe you only have c++20 and perhaps the build only works until c++17 or c++19. can you build in one of the dockerized environments noted in #20 ?

@Songlin1998
Copy link
Author

what version of libc++ do you have? maybe you only have c++20 and perhaps the build only works until c++17 or c++19. can you build in one of the dockerized environments noted in #20 ?

thank you for your reply first.

I guess the standard of C++ may effect the process of compilation, so I added 'set(CMAKE_C_FLAGS "-std=c99")
set(CMAKE_CXX_FLAGS "-std=c++14")' into instant-ngp/CMakeLists.txt.

It works, and the error above is fixed.

But another error appears:

Consolidate compiler generated dependencies of target glfw_objects
Consolidate compiler generated dependencies of target tiny-cuda-nn
[ 29%] Built target glfw_objects
[ 50%] Built target tiny-cuda-nn
Consolidate compiler generated dependencies of target ngp
[ 52%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_widgets.cpp.o
[ 54%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui.cpp.o
c++: error: unrecognized command line option ‘-std=c++14’
gmake[2]: *** [CMakeFiles/ngp.dir/dependencies/imgui/imgui_widgets.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
[ 58%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_impl_opengl3.cpp.o
[ 58%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/ImGuizmo.cpp.o
[ 60%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_impl_glfw.cpp.o
c++: error: unrecognized command line option ‘-std=c++14’
gmake[2]: *** [CMakeFiles/ngp.dir/dependencies/imgui/imgui.cpp.o] Error 1
[ 63%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_tables.cpp.o
[ 63%] Building CXX object CMakeFiles/ngp.dir/dependencies/imgui/imgui_draw.cpp.o
c++: error: unrecognized command line option ‘-std=c++14’
gmake[2]: *** [CMakeFiles/ngp.dir/dependencies/imgui/imgui_impl_glfw.cpp.o] Error 1
c++: error: unrecognized command line option ‘-std=c++14’
c++: error: unrecognized command line option ‘-std=c++14’
gmake[2]: *** [CMakeFiles/ngp.dir/dependencies/imgui/imgui_impl_opengl3.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/ngp.dir/dependencies/imgui/ImGuizmo.cpp.o] Error 1
c++: error: unrecognized command line option ‘-std=c++14’
[ 69%] Building CUDA object CMakeFiles/ngp.dir/src/nerf_loader.cu.o
[ 69%] Building CUDA object CMakeFiles/ngp.dir/src/camera_path.cu.o
[ 69%] Building CUDA object CMakeFiles/ngp.dir/src/common_device.cu.o
gmake[2]: *** [CMakeFiles/ngp.dir/dependencies/imgui/imgui_tables.cpp.o] Error 1
c++: error: unrecognized command line option ‘-std=c++14’
gmake[2]: *** [CMakeFiles/ngp.dir/dependencies/imgui/imgui_draw.cpp.o] Error 1
[ 70%] Building CUDA object CMakeFiles/ngp.dir/src/marching_cubes.cu.o
[ 72%] Building CUDA object CMakeFiles/ngp.dir/src/render_buffer.cu.o
[ 74%] Building CUDA object CMakeFiles/ngp.dir/src/testbed.cu.o
gmake[1]: *** [CMakeFiles/ngp.dir/all] Error 2
gmake: *** [all] Error 2

@Songlin1998
Copy link
Author

BTW, I checked the version of libstdc++ is libstdc++.so.6.0.24.
Should I change this version?

@pwais
Copy link
Contributor

pwais commented Feb 6, 2022

hmm well the included cmake file already specifies c++14

set(CMAKE_CXX_STANDARD 14)

but maybe it needs an additional set(CMAKE_CXX_STANDARD_REQUIRED ON)

the docker container i cited above has libstdc++.so.6.0.25. but thus far you don't appear to have a linker issue

@Tom94 Tom94 closed this as completed Mar 28, 2022
@ErdanC
Copy link

ErdanC commented May 23, 2022

Same question. How to solve this problem?

@ErdanC
Copy link

ErdanC commented May 23, 2022

@Songlin1998

@ElliotQi
Copy link

Solved this by another version of CXX compiler using
cmake . -B build -DCMAKE_CXX_COMPILER=<new version of c++>

@MarkWallbang
Copy link

Solved this by another version of CXX compiler using cmake . -B build -DCMAKE_CXX_COMPILER=<new version of c++>

What version did you use? I still have this issue... Thanks!

@youqugit
Copy link

youqugit commented Apr 26, 2023

BTW, I checked the version of libstdc++ is libstdc++.so.6.0.24. Should I change this version?

hi,How did you solve this problem in the end
你好,你最后是怎么解决的啊

@youqugit
Copy link

I solved it using this method:
1.cmake . -B build -DCMAKE_CXX_COMPILER=/ai/user/gcc-11.2.0/install/bin/g++
2.cmake --build build --config RelWithDebInfo -j 16

An error occurred :
/usr/bin/ld: libngp.a(thread_pool.cpp.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: libngp.a(tinyobj_loader_wrapper.cpp.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libngp.a(ImGuizmo.cpp.o): relocation R_X86_64_32 against .bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: libngp.a(imgui.cpp.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libngp.a(imgui_impl_glfw.cpp.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: libngp.a(imgui_impl_opengl3.cpp.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libngp.a(imgui_draw.cpp.o): relocation R_X86_64_32 against .text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: libngp.a(imgui_tables.cpp.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libngp.a(imgui_widgets.cpp.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
gmake[2]: *** [pyngp.cpython-39-x86_64-linux-gnu.so] Error 1
gmake[1]: *** [CMakeFiles/pyngp.dir/all] Error 2

然后,在CMakeList.txt 前面添加: add_compile_options(-fPIC)
then,Add before CMake List.txt: add_ compile_ options(-fPIC)

再次执行 cmake --build build --config RelWithDebInfo -j 16
Execute the command again,cmake --build build --config RelWithDebInfo -j 16

编译成功
build success

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

7 participants