OpenCV 3.4.1 build error(compile with gcc-6-1.0) on CentOS release 6.7 (Final): ld error
.
Linking CXX shared library ../../lib/libopencv_ml.so
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/main.cpp.o
/usr/local/bin/ld: ../../lib/libopencv_core.so.3.4.1: __bss_start: invalid version 21 (max 0)
/usr/local/bin/ld: ../../lib/libopencv_core.so.3.4.1: error adding symbols: bad value
collect2: 错误:ld 返回 1
make[2]: *** [lib/libopencv_ml.so.3.4.1] 错误 1
make[1]: *** [modules/ml/CMakeFiles/opencv_ml.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.cpp.o
[ 50%] [ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/convhull.cpp.o
Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/corner.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/emd.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.dispatch.cpp.o
[ 50%] [ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/hough.cpp.o
Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/cornersubpix.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/sumpixels.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/samplers.cpp.o
[ 50%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/clahe.cpp.o
[ 50%] [ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/phasecorr.cpp.o
Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/generalized_hough.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/contours.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/shapedescr.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/utils.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/grabcut.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/gabor.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/opencl_kernels_imgproc.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/imgwarp.sse4_1.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/resize.sse4_1.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/corner.avx.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/accum.avx.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/imgwarp.avx2.cpp.o
[ 51%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/resize.avx2.cpp.o
[ 52%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/undistort.avx2.cpp.o
[ 52%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/filter.avx2.cpp.o
Linking CXX shared library ../../lib/libopencv_flann.so
/usr/local/bin/ld: ../../lib/libopencv_core.so.3.4.1: __bss_start: invalid version 21 (max 0)
/usr/local/bin/ld: ../../lib/libopencv_core.so.3.4.1: error adding symbols: bad value
collect2: 错误:ld 返回 1
make[2]: *** [lib/libopencv_flann.so.3.4.1] 错误 1
make[1]: *** [modules/flann/CMakeFiles/opencv_flann.dir/all] 错误 2
Linking CXX shared library ../../lib/libopencv_imgproc.so
/usr/local/bin/ld: ../../lib/libopencv_core ...
centos seems to come with an outdated gcc, a lot of ppl having trouble with it.
can you try to update the compiler ?
Thank you. but I used gcc-6.1.0 to compile opecv-3.4.1, not the system build-in gcc-4.4.7.
I found that ld (binutils-2.31's) caused this error. This error may relate to AVX
maybe you have to disable the CPU_DISPATCH options like:
(leave it an empty list)
I tried the commad:
but the same error occurred when compiling: