Ask Your Question
0

OpenCV 3.4.1 build error(compile with gcc-6-1.0) on CentOS release 6.7 (Final): ld error

asked 2018-08-11 04:30:44 -0600

Deng gravatar image

updated 2018-08-11 05:24:35 -0600

.

 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 ...
(more)
edit retag flag offensive close merge delete

Comments

centos seems to come with an outdated gcc, a lot of ppl having trouble with it.

can you try to update the compiler ?

berak gravatar imageberak ( 2018-08-11 04:38:22 -0600 )edit
1

Thank you. but I used gcc-6.1.0 to compile opecv-3.4.1, not the system build-in gcc-4.4.7.

Deng gravatar imageDeng ( 2018-08-11 05:19:45 -0600 )edit

I found that ld (binutils-2.31's) caused this error. This error may relate to AVX

Deng gravatar imageDeng ( 2018-08-13 04:18:54 -0600 )edit

maybe you have to disable the CPU_DISPATCH options like:

cmake -DCPU_DISPATCH=""

(leave it an empty list)

berak gravatar imageberak ( 2018-08-13 04:26:31 -0600 )edit

I tried the commad:

cmake -DCPU_DISPATCH="" ../

but the same error occurred when compiling:

Linking CXX shared library ../../lib/libopencv_ml.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
Deng gravatar imageDeng ( 2018-08-13 08:13:32 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2018-08-13 10:29:08 -0600

Deng gravatar image

Finally, I know what was wrong. To support some AVX2 instructions, I installed binutils-2.31, I added LIBDIR of binutils-2.31 to LD_LIBRARY_PATH environment variable, but i didn't add it to LD_RUN_PATH environment variable. So, error occurred during linking! The problem was solved by adding LIBDIR of binutils to LD_RUN_PATH environment variable.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-08-11 04:30:44 -0600

Seen: 935 times

Last updated: Aug 11 '18