Ask Your Question

Revision history [back]

OpenCV 3.3.0 Build error - AVX2 code throwing assembly messages

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!