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

gcc versions error when installing OpenCV 3.1.0 #6513

Closed
Xiaoming-Zhao opened this issue May 8, 2016 · 4 comments
Closed

gcc versions error when installing OpenCV 3.1.0 #6513

Xiaoming-Zhao opened this issue May 8, 2016 · 4 comments
Labels

Comments

@Xiaoming-Zhao
Copy link

Hi, I met a problem in installing OpenCV 3.1.0

  • Host OS: Linux (Ubuntu 15.10 x86_64)
  • CUDA 7.5.17

I installed CUDA first, and when I followed this installation guide, I met an error at make -j2:

[ 18%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o
In file included from /usr/local/cuda-7.5/include/cuda_runtime.h:76:0,
                 from <command-line>:0:
/usr/local/cuda-7.5/include/host_config.h:115:2: error: #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
 #error -- unsupported GNU version! gcc versions later than 4.9 are not supported!
  ^
CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:208 (message):
  Error generating
  /home/zhaoxiaoming/opencv-3.1.0/build/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/./cuda_compile_generated_gpu_mat.cu.o


modules/core/CMakeFiles/opencv_core.dir/build.make:55: recipe for target 'modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o' failed
make[2]: *** [modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_generated_gpu_mat.cu.o] Error 1
CMakeFiles/Makefile2:1184: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed

About my gcc, I checked my /usr/bin/, there are three versions of gcc and g++, namely 4.8.5, 4.9.3 and 5.2.1. Because when using CUDA, it required gcc no later than 4.9, so I did the following:

sudo ln -s /usr/bin/gcc-4.9 /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/g++-4.9 /usr/local/cuda/bin/g++

And when met the OpenCV error, I did the following:

sudo ln -s /usr/bin/gcc-4.8 /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/g++-4.8 /usr/local/cuda/bin/g++

And when I usegcc --version to check, the output is 4.8.5.

I am wondering whether there is a method to let the OpenCV make -j2 procedure uses exactly the right gcc version?

Thanks!

@StevenPuttemans
Copy link

You could open up the cmake-gui and explicitly tell it which compiler you want to use from the first drop down menu I guess.

@alalek
Copy link
Member

alalek commented May 11, 2016

http://stackoverflow.com/questions/17275348/how-to-specify-new-gcc-path-for-cmake
but It is hard to say how does this help CUDA NVCC

@Rohith25
Copy link

Rohith25 commented Jun 15, 2016

I kinda had the same issue. Apparently NVCC needs to have its flag set manually. Add the following to cmake and it works fine

CUDA_NVCC_FLAGS="-ccbin gcc-4.9"

@bonben
Copy link

bonben commented Nov 22, 2016

Fix by setting parameter :
//Host side compiler used by NVCC
CUDA_HOST_COMPILER:FILEPATH=/usr/bin/gcc-4.9

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

No branches or pull requests

6 participants