Skip to content

Instantly share code, notes, and snippets.

@tomoaki0705
Last active July 6, 2022 12:53
Show Gist options
  • Select an option

  • Save tomoaki0705/cfed9b90a0807e02eeebf90cc395a2bb to your computer and use it in GitHub Desktop.

Select an option

Save tomoaki0705/cfed9b90a0807e02eeebf90cc395a2bb to your computer and use it in GitHub Desktop.

Revisions

  1. tomoaki0705 revised this gist Jul 6, 2022. 1 changed file with 10 additions and 12 deletions.
    22 changes: 10 additions & 12 deletions draft.md
    Original file line number Diff line number Diff line change
    @@ -59,30 +59,28 @@ After googling a while, I came up to conclusion that this is a possible ABI mism

    > 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 to warning is raised.
    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 option is not acceptable for `pragma`

    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.


    ##### Steps to reproduce

    <!-- to add code example fence it with triple backticks and optional file extension
    ```.cpp
    // C++ code example
    ```
    or attach as .txt or .zip file
    -->
    Build recent OpenCV on GCC 7 or later on Arm 32bit platform

    ##### Issue submission checklist

    - [ ] I report the issue, it's not a question
    - [x] I report the issue, it's not a question
    <!--
    OpenCV team works with forum.opencv.org, Stack Overflow and other communities
    to discuss problems. Tickets with questions without a real issue statement will be
    closed.
    -->
    - [ ] I checked the problem with documentation, FAQ, open issues,
    - [x] I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
    <!--
    Places to check:
    @@ -92,13 +90,13 @@ Thus, I have to insert `ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-psabi)` to eve
    * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
    * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
    -->
    - [ ] I updated to the latest OpenCV version and the issue is still there
    - [x] I updated to the latest OpenCV version and the issue is still there
    <!--
    master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
    OpenCV team supports only the latest release for each branch.
    The ticket is closed if the problem is not reproduced with the modern version.
    -->
    - [ ] There is reproducer code and related data files: videos, images, onnx, etc
    - [x] There is reproducer code and related data files: videos, images, onnx, etc
    <!--
    The best reproducer -- test case for OpenCV that we can add to the library.
    Recommendations for media files and binary files:
  2. tomoaki0705 created this gist Jul 6, 2022.
    114 changes: 114 additions & 0 deletions draft.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,114 @@
    <!--
    If you have a question rather than reporting a bug please go to https://forum.opencv.org where you get much faster responses.
    If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
    This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
    -->

    ##### System information (version)
    <!-- Example
    - OpenCV => 4.2
    - Operating System / Platform => Windows 64 Bit
    - Compiler => Visual Studio 2017
    -->

    - OpenCV => recent 3.4 branch ( 3891b72f33572a55a038b6859909f65218533b9a )
    - Operating System / Platform => Ubuntu 22.04 Arm 32bit (ODROID-XU4)
    - Compiler => GCC 11.2

    ##### Detailed description

    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 to warning is raised.
    The only workaround is to use `-Wno-psabi`.
    I tried to minimize the modification by using "pragma pop" but this option is not acceptable for `pragma`
    Thus, I have to insert `ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-psabi)` to every module that triggers this warning.


    ##### Steps to reproduce

    <!-- to add code example fence it with triple backticks and optional file extension
    ```.cpp
    // C++ code example
    ```
    or attach as .txt or .zip file
    -->

    ##### Issue submission checklist

    - [ ] I report the issue, it's not a question
    <!--
    OpenCV team works with forum.opencv.org, Stack Overflow and other communities
    to discuss problems. Tickets with questions without a real issue statement will be
    closed.
    -->
    - [ ] I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
    <!--
    Places to check:
    * OpenCV documentation: https://docs.opencv.org
    * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
    * OpenCV forum: https://forum.opencv.org
    * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
    * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
    -->
    - [ ] I updated to the latest OpenCV version and the issue is still there
    <!--
    master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
    OpenCV team supports only the latest release for each branch.
    The ticket is closed if the problem is not reproduced with the modern version.
    -->
    - [ ] There is reproducer code and related data files: videos, images, onnx, etc
    <!--
    The best reproducer -- test case for OpenCV that we can add to the library.
    Recommendations for media files and binary files:
    * Try to reproduce the issue with images and videos in opencv_extra repository
    to reduce attachment size
    * Use PNG for images, if you report some CV related bug, but not image reader
    issue
    * Attach the image as an archive to the ticket, if you report some reader issue.
    Image hosting services compress images and it breaks the repro code.
    * Provide ONNX file for some public model or ONNX file with random weights,
    if you report ONNX parsing or handling issue. Architecture details diagram
    from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
    -->