Trying to install openCV 3.1, CUDA 8.0.44 on Ubuntu 16.04 by building from the source.
尝试安装openCV 3.1, CUDA 8.0.44在Ubuntu 16.04上从源代码构建。
The following are the errors I met during the compilation.
以下是我在编译期间遇到的错误。
Scanning dependencies of target opencv_test_video
[ 37%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_optflowpyrlk.cpp.o
[ 37%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_accum.cpp.o
[ 37%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_kalman.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_ecc.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_tvl1optflow.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_main.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_camshift.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/ocl/test_optflowpyrlk.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/ocl/test_optflow_farneback.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/ocl/test_bgfg_mog2.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/ocl/test_optflow_tvl1flow.cpp.o
[ 38%] Building CXX object modules/video/CMakeFiles/opencv_test_video.dir/test/test_estimaterigid.cpp.o
[ 38%] Linking CXX executable ../../bin/opencv_test_video
//usr/lib/x86_64-linux-gnu/libsoxr.so.0: undefined reference to `GOMP_parallel@GOMP_4.0'
collect2: error: ld returned 1 exit status
modules/video/CMakeFiles/opencv_test_video.dir/build.make:391: recipe for target 'bin/opencv_test_video' failed
make[2]: *** [bin/opencv_test_video] Error 1
CMakeFiles/Makefile2:3336: recipe for target 'modules/video/CMakeFiles/opencv_test_video.dir/all' failed
make[1]: *** [modules/video/CMakeFiles/opencv_test_video.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I consider the issue is related to the openMP or the ld configuration.
我认为这个问题与openMP或ld配置有关。
The following are the detailed configuration:
具体配置如下:
- LD_LIBRARY_PATH:
- LD_LIBRARY_PATH:
/usr/lib/nvidia-current:/usr/local/cuda/lib64:/usr/local/cuda/lib
/usr/lib/nvidia-current:/ usr /地方/ cuda / lib64:/ usr /地方/ cuda / lib
-
GCC version: 5.4.0
GCC版本:5.4.0
-
CMake configuration command:
CMake配置命令:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..
cmake -D CMAKE_BUILD_TYPE=发布-D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES"
1 个解决方案
#1
17
Firstly, I thought this problem was caused because I installed Anaconda and put it into my PATH
.
首先,我认为这个问题是由于我安装了蟒蛇并把它放进了我的路径。
Different GCC version are used between Anaconda and System default. For Ubuntu 16.04, the GCC version is 5.4.0 however Anaconda only provides GCC 4 (I can't remember it's 4.4 or 4.8). Although I used the system default gcc to compile opencv, it somehow will find the lib located in Anaconda, which caused the problem.
在Anaconda和系统默认之间使用不同的GCC版本。对于Ubuntu 16.04, GCC版本是5.4.0,但是Anaconda只提供GCC 4(我不记得是4.4还是4.8)。虽然我使用系统默认的gcc来编译opencv,但是它会以某种方式找到位于Anaconda中的lib,这导致了问题。
I think there are two ways to solve this issue.
我认为有两种方法可以解决这个问题。
- Method 1: Pass the option
-D WITH_OPENMP=ON
, or, when using cmake-gui, check the choiceWITH-OPENMP
. - 方法1:使用_openmp =传递选项-D,或者在使用cmake-gui时,使用- openmp检查选项。
- Method 2: Delete Anaconda from your
$PATH
andLD_LIBRARY_PATH
. - 方法2:从$PATH和LD_LIBRARY_PATH中删除蟒蛇。
#1
17
Firstly, I thought this problem was caused because I installed Anaconda and put it into my PATH
.
首先,我认为这个问题是由于我安装了蟒蛇并把它放进了我的路径。
Different GCC version are used between Anaconda and System default. For Ubuntu 16.04, the GCC version is 5.4.0 however Anaconda only provides GCC 4 (I can't remember it's 4.4 or 4.8). Although I used the system default gcc to compile opencv, it somehow will find the lib located in Anaconda, which caused the problem.
在Anaconda和系统默认之间使用不同的GCC版本。对于Ubuntu 16.04, GCC版本是5.4.0,但是Anaconda只提供GCC 4(我不记得是4.4还是4.8)。虽然我使用系统默认的gcc来编译opencv,但是它会以某种方式找到位于Anaconda中的lib,这导致了问题。
I think there are two ways to solve this issue.
我认为有两种方法可以解决这个问题。
- Method 1: Pass the option
-D WITH_OPENMP=ON
, or, when using cmake-gui, check the choiceWITH-OPENMP
. - 方法1:使用_openmp =传递选项-D,或者在使用cmake-gui时,使用- openmp检查选项。
- Method 2: Delete Anaconda from your
$PATH
andLD_LIBRARY_PATH
. - 方法2:从$PATH和LD_LIBRARY_PATH中删除蟒蛇。