Compilation error on i686 when using AVX only intended for x86_64
Summary
There is a compilation error when building opencv (4.11+) with Eigen 5.0.0 on i686 architecture when opencv tries to build an AVX optimized version of the mathfuncs_core.c. Some functions aren't available on i686 while been dedicated to x86_64.
While i686 build is unlikely to be of much use nowadays fixing this error will improve correctness and keep the package feature parity with other architectures.
Environment
- Operating System : Linux
- Architecture : i686
- Eigen Version : 5.0.0
- Compiler Version : gcc-15
- Compile Flags :
- Vector Extension : AVX
Minimal Example
Steps to reproduce the issue
- build opencv for i686 with eigen-5.0.0 support enabled.
What is the current bug behavior?
A compilation error occurs.
What is the expected correct behavior?
Compilation should succeed.
Relevant logs
In file included from /usr/include/eigen3/Eigen/Core:235,
from /builddir/build/BUILD/opencv-4.11.0-build/opencv-4.11.0/modules/core/include/opencv2/core/private.hpp:70,
from /builddir/build/BUILD/opencv-4.11.0-build/opencv-4.11.0/modules/core/src/precomp.hpp:59,
from /builddir/build/BUILD/opencv-4.11.0-build/opencv-4.11.0/redhat-linux-build/modules/core/mathfuncs_core.avx.cpp:2:
/usr/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h: In function ‘__m128i Eigen::internal::segment_mask_4x8(Eigen::Index, Eigen::Index)’:
/usr/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h:2837:10: error: ‘_mm_cvtsi64_si128’ was not declared in this scope; did you mean ‘_mm_cvtsi64_si32’?
2837 | return _mm_cvtsi64_si128(mask);
| ^~~~~~~~~~~~~~~~~
| _mm_cvtsi64_si32
/usr/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h: In function ‘__m128i Eigen::internal::segment_mask_8x8(Eigen::Index, Eigen::Index)’:
/usr/include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h:2853:10: error: ‘_mm_cvtsi64_si128’ was not declared in this scope; did you mean ‘_mm_cvtsi64_si32’?
2853 | return _mm_cvtsi64_si128(mask);
| ^~~~~~~~~~~~~~~~~
| _mm_cvtsi64_si32
gmake[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:1425: modules/core/CMakeFiles/opencv_core.dir/mathfuncs_core.avx.cpp.o] Error 1
Anything else that might help
There should be a mean to disable building avx enabled code within opencv as a workaround. That said, previous eigen3 (< 5.0) previously succeeded.
Edited by Nicolas Chauvet