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

Question about building PlusServer with OpenCV on Ubuntu 20.04.1 #767

Closed
nist-anka opened this issue Jan 19, 2021 · 17 comments
Closed

Question about building PlusServer with OpenCV on Ubuntu 20.04.1 #767

nist-anka opened this issue Jan 19, 2021 · 17 comments

Comments

@nist-anka
Copy link

Ubuntu 20.04.1 LTS, NVIDIA Corporation GP104 [GeForce GTX 1070], Driver Version: 460.27.04 CUDA Version: 11.2.
CMake 3.16.3.

I want to build PlusServer with options: PLUSBUILD_USE_OpenCV and PLUS_USE_OpenCV_VIDEO on.

I have gcc8 ((Ubuntu 8.4.0-3ubuntu2) 8.4.0) installed by Nvidia, and gcc9 ((Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0) on my system.
I set gcc8 as compiler in CMake and I am getting this building error:

error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!
138 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
| ^~~~~
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake:220 (message):
Error generating
xxx/OpenCV-bin/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o

Please, advise what should I do.
I would like to use PlusServer with webcam.

@adamrankin
Copy link
Member

Find the line of code with that #error message and comment it out. See if gcc8 works

@nist-anka
Copy link
Author

nist-anka commented Jan 19, 2021 via email

@adamrankin
Copy link
Member

Yes

@nist-anka
Copy link
Author

Now , after commenting the line
//#error -- unsupported GNU version! gcc versions later than 8 are not supported!
in /usr/include/crt/host_config.h
it is:
[ 39%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o
/usr/include/c++/9/bits/stl_function.h(437): error: identifier "__builtin_is_constant_evaluated" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00018adf_00000000-14_gpu_mat.compute_75.cpp1.ii".
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake:280 (message):
Error generating file
/home/anka/Plus/bin/OpenCV-bin/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o

make[5]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:484: modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:2644: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make[3]: *** [Makefile:163: all] Error 2
make[2]: *** [CMakeFiles/OpenCV.dir/build.make:113: OpenCV-prefix/src/OpenCV-stamp/OpenCV-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:233: CMakeFiles/OpenCV.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

@adamrankin
Copy link
Member

Ok. You'll have to use a newer version of Cuda or disable cuda for OpenCV

@markasselin
Copy link
Contributor

Another idea would be to install an older version of gcc (5,6 or 7) and set it as default using update-alternatives. As far as I know PLUS still supports these, @adamrankin is this still the case?

@adamrankin
Copy link
Member

It will probably compile. Whatever is default in ubuntu 18.04 and newer are supported.

@adamrankin
Copy link
Member

A similar experience here:
espressomd/espresso#3654

@nist-anka
Copy link
Author

Thanks, I tried gcc-7.5 but got different errors, I am trying your suggested: espressomd/espresso#3654
What should I set as CUDA_SDK_ROOT_DIR, I tried the top /usr/local/cuda-11.2 but it was rejected.

@adamrankin
Copy link
Member

Why was it rejected?

@nist-anka
Copy link
Author

nist-anka commented Jan 20, 2021 via email

@nist-anka
Copy link
Author

After looking around, my UDA_SDK_ROOT_DIR
is
/usr/local/cuda-11.2/samples/common
if anyone else ever looks at this problem.
Other issue is
fatal error: dynlink_nvcuvid.h: No such file or directory
#include <dynlink_nvcuvid.h>

It seems, that cuda video decoder is deprecated.

@nist-anka
Copy link
Author

I added option
-DBUILD_opencv_cudacodec=OFF

to External_OpenCV.cmake and managed to build OpenCV. It was very slow comparing to building vtk.

@adamrankin
Copy link
Member

Yes, there is a recommendation in the cmake configure output to set the cuda generation variable to only build for your current card (if building for yourself). Drastically reduces compile time.

@nist-anka
Copy link
Author

nist-anka commented Jan 20, 2021 via email

@nist-anka
Copy link
Author

Problem solved. Thank you for all your help.

@nist-anka
Copy link
Author

nist-anka commented Jan 21, 2021 via email

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

3 participants