Ask Your Question
0

OpenCV 3.3.0 Build error - AVX2 code throwing assembly messages

asked 2017-10-31 20:55:46 -0600

I am building a baseline OpenCV 3.3.0 for a CentOS 6.9 x86_64 Intel i5 650 @ 3.2GHz. I am not a sudoer.
After running: cmake -D CMAKE_INSTALL_PREFIX=/home/user/lib/opencv330/build/install -D BUILD_EXAMPLES=ON -D BUILD_JASPER=ON -D BUILD_JPEG=ON -D BUILD_OPENEXR=ON -D BUILD_PNG=ON -D BUILD_TIFF=ON -D BUILD_ZLIB=ON -D BUILD_opencv_world=ON -D WITH_CUBLAS=OFF -D WITH_CUDA=OFF -D WITH_CUFFT=OFF -D WITH_IPP=OFF -D WITH_ITT=OFF -D WITH_OPENCL=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_OPENCLAMDFFT=OFF ..
And then: make
It happily builds all the dependencies, but when it reaches the core module, it outputs assembly errors complaining about 'no such instruction' or 'suffix or operands invalid for vpaddq' ... while trying to build modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx2.cpp.o

I searched and found a thread from another who had a similar problem, but was building an older version of OpenCV. I checked it anyway: cat /proc/cpuinfo; it did NOT list FP16, SSE3, AVX, and AVX2. His post referred to a missing SSE3 set as well.

So, I rm'd the entire build directory and ran a fresh CMake:
cmake -D CMAKE_INSTALL_PREFIX=/home/user/lib/opencv330/build/install -D BUILD_EXAMPLES=ON -D BUILD_JASPER=ON -D BUILD_JPEG=ON -D BUILD_OPENEXR=ON -D BUILD_PNG=ON -D BUILD_TIFF=ON -D BUILD_ZLIB=ON -D BUILD_opencv_world=ON -D WITH_CUBLAS=OFF -D WITH_CUDA=OFF -D WITH_CUFFT=OFF -D WITH_IPP=OFF -D WITH_ITT=OFF -D WITH_OPENCL=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_OPENCLAMDFFT=OFF -D CPU_BASELINE_DISABLE=SSE3,AVX2 ..
Again: make

This time, it successfully built the core module!
...Only to have remarkably similar errors as before thrown during the imgproc module.
Here's the output:
[ 33%] Built target opencv_core
[ 33%] Generating opencl_kernels_imgproc.cpp, opencl_kernels_imgproc.hpp
Scanning dependencies of target opencv_imgproc
[ 33%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.cpp.o
[ 33%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.dispatch.cpp.o
.
.
[ 37%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/opencl_kernels_imgproc.cpp.o
[ 37%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/accum.sse2.cpp.o
[ 37%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/imgwarp.sse4_1.cpp.o
[ 37%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/corner.avx.cpp.o
[ 37%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/accum.avx.cpp.o
[ 37%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/imgwarp.avx2.cpp.o
/tmp/ccFZNVK2.s: Assembler messages:
/tmp/ccFZNVK2.s:51: Error: suffix or operands invalid for 'vpcmpeqd'
/tmp/ccFZNVK2.s:100: Error: no such instruction: 'vpgatherdd %ymm6,(%rdx,%ymm1,1),%ymm0'

This smells like a bug somewhere, but where? Maybe somehow it ignores the value of CPU_BASELINE_DISABLE=SSE3,AVX2 when it generates the makefile, after it gets to the imgproc module? Where would this be located? It successfully skips building AVX2 in core, too.
Any help would be greatly appreciated!

edit retag flag offensive close merge delete

Comments

Maybe you can try to open an issue here?

Eduardo gravatar imageEduardo ( 2017-11-02 08:23:54 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-06-04 02:37:45 -0600

Your version of binutils is too old to support AVX/AVX2 instructions, which have been detected as available on your processor. You need binutils 2.22 or newer for AVX support.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-10-31 20:55:46 -0600

Seen: 1,722 times

Last updated: Oct 31 '17