New issue
Advanced search Search tips

Issue 801269 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Jan 2018
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 800984



Sign in to add a comment

media-libs/opencv fails to build with llvm-next

Project Member Reported by rahulchaudhry@chromium.org, Jan 11 2018

Issue description

This happens when testing the next version of llvm: https://bugs.chromium.org/p/chromium/issues/detail?id=800984

For chell (amd64), media-libs/opencv build fails with new warnings and errors.

The new warnings are from -Wabsolute-value (taking the absolute value of unsigned type 'const unsigned char' has no effect).
Here is one example:
../../../OpenCV-2.3.0/modules/core/src/stat.cpp:819:50: warning: taking the absolute value of unsigned type 'const unsigned char' has no effect [-Wabsolute-value]
                    result = std::max(result, ST(std::abs(src[k])));
                                                 ^
../../../OpenCV-2.3.0/modules/core/src/stat.cpp:819:50: note: remove the call to 'std::abs' since unsigned values cannot be negative
                    result = std::max(result, ST(std::abs(src[k])));
                                                 ^~~~~~~~


The new errors are from -Wc++11-narrowing (constant expression evaluates to 4294967295 which cannot be narrowed to type 'int').
Here is one example:
../../../OpenCV-2.3.0/modules/core/src/arithm.cpp:433:51: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                  ^~~~~~~~~~
../../../OpenCV-2.3.0/modules/core/src/arithm.cpp:433:51: note: insert an explicit cast to silence this issue
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
                                                  ^~~~~~~~~~
                                                  static_cast<int>( )

 
For daisy (arm), media-libs/opencv build fails with different warnings.

The new warnings are from [-Wdelete-non-virtual-dtor] and [-Wunused-result].

Here is one example of [-Wdelete-non-virtual-dtor]:
../../../OpenCV-2.3.0/modules/core/include/opencv2/core/operations.hpp:2387:15: warning: delete called on 'ExposureCompensator' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
    if( obj ) delete obj;
              ^
../../../OpenCV-2.3.0/modules/core/include/opencv2/core/operations.hpp:2378:9: note: in instantiation of member function 'cv::Ptr<ExposureCompensator>::delete_obj' requested here
        delete_obj();
        ^
../../../OpenCV-2.3.0/modules/core/include/opencv2/core/operations.hpp:2390:50: note: in instantiation of member function 'cv::Ptr<ExposureCompensator>::release' requested here
template<typename _Tp> inline Ptr<_Tp>::~Ptr() { release(); } 
                                                 ^
../../../OpenCV-2.3.0/modules/stitching/main.cpp:482:44: note: in instantiation of member function 'cv::Ptr<ExposureCompensator>::~Ptr' requested here
    Ptr<ExposureCompensator> compensator = ExposureCompensator::createDefault(expos_comp_type);
                                           ^

Here is one example of [-Wunused-result]:
../../../OpenCV-2.3.0/modules/traincascade/imagestorage.cpp:153:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    fread( &tmp, sizeof( tmp ), 1, file );
    ^~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Project Member

Comment 2 by bugdroid1@chromium.org, Jan 12 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/e982bc33dd534ed3b85238a7bba398e82bd88643

commit e982bc33dd534ed3b85238a7bba398e82bd88643
Author: Rahul Chaudhry <rahulchaudhry@chromium.org>
Date: Fri Jan 12 11:27:18 2018

media-libs/opencv: fix build issue with llvm-next.

BUG= chromium:801269 
TEST='arithm.cpp' compiles with llvm-next.

Change-Id: Ib5f8938ce09c23fb27b569f34dd49f9977f782b1
Reviewed-on: https://chromium-review.googlesource.com/862738
Commit-Ready: Rahul Chaudhry <rahulchaudhry@chromium.org>
Tested-by: Rahul Chaudhry <rahulchaudhry@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>

[rename] https://crrev.com/e982bc33dd534ed3b85238a7bba398e82bd88643/media-libs/opencv/opencv-2.3.0-r9.ebuild
[add] https://crrev.com/e982bc33dd534ed3b85238a7bba398e82bd88643/media-libs/opencv/files/opencv-2.3.0-narrowing.patch

With the above change, the original [-Wc++11-narrowing] errors are gone.
The build now fails for modules/contrib/src/spinimages.cpp with:
/build/chell/tmp/portage/media-libs/opencv-2.3.0-r9/work/OpenCV-2.3.0/modules/contrib/src/spinimages.cpp:793:9: error: call to 'iota' is ambiguous
        iota(subset.begin(), subset.end(), 0);
        ^~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/4.9.x/include/g++-v4/bits/stl_numeric.h:82:5: note: candidate function [with _ForwardIterator = __gnu_cxx::__normal_iterator<int *, std::vector<int, std::allocator<int> > >, _Tp = int]
    iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
    ^
/build/chell/tmp/portage/media-libs/opencv-2.3.0-r9/work/OpenCV-2.3.0/modules/contrib/src/spinimages.cpp:88:36: note: candidate function [with FwIt = __gnu_cxx::__normal_iterator<int *, std::vector<int, std::allocator<int> > >, T = int]
template<class FwIt, class T> void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
                                   ^
The ambiguity is between 'iota' defined in <numeric> and another version defined inside "modules/contrib/src/spinimages.cpp" itself.

Project Member

Comment 4 by bugdroid1@chromium.org, Jan 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/19b1603f5b0518af8135c7e7ffc3c0b09b2f0eca

commit 19b1603f5b0518af8135c7e7ffc3c0b09b2f0eca
Author: Rahul Chaudhry <rahulchaudhry@chromium.org>
Date: Fri Jan 19 01:40:34 2018

media-libs/opencv: fix build issue with llvm-next.

BUG= chromium:801269 
TEST='cv.cpp' compiles with llvm-next.

Change-Id: I8cc7fdfbea067f9973c7dc0354526b0e1c16a212
Reviewed-on: https://chromium-review.googlesource.com/872217
Commit-Ready: Rahul Chaudhry <rahulchaudhry@chromium.org>
Tested-by: Rahul Chaudhry <rahulchaudhry@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>

[rename] https://crrev.com/19b1603f5b0518af8135c7e7ffc3c0b09b2f0eca/media-libs/opencv/opencv-2.3.0-r11.ebuild
[modify] https://crrev.com/19b1603f5b0518af8135c7e7ffc3c0b09b2f0eca/media-libs/opencv/files/opencv-2.3.0-narrowing.patch

Project Member

Comment 5 by bugdroid1@chromium.org, Jan 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/c63b9d12450f9706912fc49c736d589431c85a08

commit c63b9d12450f9706912fc49c736d589431c85a08
Author: Rahul Chaudhry <rahulchaudhry@chromium.org>
Date: Fri Jan 19 04:18:14 2018

media-libs/opencv: fix build issue with llvm-next.

With new llvm, the build is failing due to ambiguous call to 'iota'.
'iota' is defined in 'stl_numeric.h', as well as locally.
Rename the local version so it does not conflict with std.

BUG= chromium:801269 
TEST='emerge-chell media-libs/opencv' builds with llvm-next.

Change-Id: I20f15a2a31826977db7143f754e5fe236671cc86
Reviewed-on: https://chromium-review.googlesource.com/872218
Commit-Ready: Rahul Chaudhry <rahulchaudhry@chromium.org>
Tested-by: Rahul Chaudhry <rahulchaudhry@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[rename] https://crrev.com/c63b9d12450f9706912fc49c736d589431c85a08/media-libs/opencv/opencv-2.3.0-r12.ebuild
[add] https://crrev.com/c63b9d12450f9706912fc49c736d589431c85a08/media-libs/opencv/files/opencv-2.3.0-local-iota.patch

Status: Fixed (was: Untriaged)

Sign in to add a comment