2021年3月2日 星期二

ubuntu 20 + opencv dnn

錯誤訊息:

[ 4%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/ src/cuda/cuda_compile_1_generated_gpu_mat.cu.o
In file included from /usr/include/cuda_runtime.h:83, from <command-line>:
/usr/include/crt/host_config.h:138:2: 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 sup ported! | ^~~~~
[ 4%] Building CXX object 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/src/goog le/protobuf/generated_message_table_driven_lite.cc.o
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.RELEASE.cmake:222 (message) : Error generating /home/xd/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cu da_compile_1_generated_gpu_mat.cu.o


簡單說: unsupported GNU version! gcc versions later than 8 are not supported!


因為電腦用cuda 10.1, 最高只支援gcc-8, 下面連結有對照表
https://stackoverflow.com/questions/6622454/cuda-incompatible-with-my-gcc-version

ubuntu20已經有包含gcc-8與gcc-9, 預設是gcc-9, 改一下就好

步驟如下
sudo rm /usr/bin/gcc
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/gcc-8 /usr/bin/gcc
sudo ln -s /usr/bin/g++-8 /usr/bin/g++


沒有留言: