- OpenCV => recent 3.4 branch ( 3891b72f33572a55a038b6859909f65218533b9a )
- Operating System / Platform => Ubuntu 22.04 Arm 32bit (ODROID-XU4)
- Compiler => GCC 11.2
There are somany warnings such as following
In file included from /usr/include/c++/11/vector:72,
from /usr/include/c++/11/functional:62,
from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
from /usr/include/c++/11/algorithm:74,
from /opencv-fork/modules/core/include/opencv2/core/base.hpp:55,
from /opencv-fork/modules/core/include/opencv2/core.hpp:53,
from /opencv-fork/modules/core/include/opencv2/core/utility.hpp:56,
from /opencv-fork/modules/calib3d/src/precomp.hpp:45,
from /opencv-fork/modules/calib3d/src/five-point.cpp:32:
/usr/include/c++/11/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {const double&}; _Tp = double; _Alloc = std::allocator<double>]':
/usr/include/c++/11/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<double, std::allocator<double> >::iterator' changed in GCC 7.1
426 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {double}; _Tp = double; _Alloc = std::allocator<double>]':
/usr/include/c++/11/bits/vector.tcc:426:7: note: parameter passing for argument of type 'std::vector<double, std::allocator<double> >::iterator' changed in GCC 7.1
/usr/include/c++/11/bits/vector.tcc: In member function 'virtual int cv::EMEstimatorCallback::runKernel(cv::InputArray, cv::InputArray, cv::OutputArray) const':
/usr/include/c++/11/bits/vector.tcc:121:28: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >' changed in GCC 7.1
121 | _M_realloc_insert(end(), std::forward<_Args>(__args)...);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc:121:28: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator<double> > >' changed in GCC 7.1
121 | _M_realloc_insert(end(), std::forward<_Args>(__args)...);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are SOOOO many lines such as this line
$ grep -c "changed in GCC" arm-build.log
708
After googling a while, I came up to conclusion that this is a possible ABI mismatch when running on a different machine from compiled one.
- https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m
- https://gcc.gnu.org/gcc-7/changes.html
This is an ABI change. If the option -Wpsabi is enabled (on by default) the compiler will emit a diagnostic note for code that might be affected.
More to write here, but as a summary, this begins with a GCC bug, and the warning is raised.
The only workaround is to use -Wno-psabi
.
I tried to minimize the modification by using pragma pop
but this -Wno-psabi
was not available with combination with pragma
.
Thus, I have to insert ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-psabi)
to every module that triggers this warning.
I'll send a patch later, but I hope my solution is acceptable.
Build recent OpenCV on GCC 7 or later on Arm 32bit platform
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc