Bug 1889607

Summary: opencv: FTBFS in Fedora rawhide
Product: [Fedora] Fedora Reporter: Jitka Plesnikova <jplesnik>
Component: opencvAssignee: Nicolas Chauvet (kwizart) <kwizart>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: andrew, hhorak, jkucera, jmlich83, jridky, karlthered, kwizart, pkajaba, rakesh.pandit, sergio, viktor.vix.jancik
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://koschei.fedoraproject.org/package/opencv
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-09 09:48:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jitka Plesnikova 2020-10-20 07:58:36 UTC
Description of problem:
Package opencv fails to build from source in Fedora rawhide with error:

[ 12%] Built target opencv_img_hash
gmake[2]: Leaving directory '/builddir/build/BUILD/opencv-4.3.0/x86_64-redhat-linux-gnu'
/builddir/build/BUILD/opencv-4.3.0/modules/imgcodecs/src/grfmt_jpeg2000.cpp: In member function 'bool cv::Jpeg2KDecoder::readComponent8u(uchar*, void*, int, int, int, int, int)':
/builddir/build/BUILD/opencv-4.3.0/modules/imgcodecs/src/grfmt_jpeg2000.cpp:381:48: error: lvalue required as unary '&' operand
  381 |         jas_seqent_t* pix_row = &jas_matrix_get( buffer, y / ystep, 0 );
      |                                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
[...]
/builddir/build/BUILD/opencv-4.3.0/modules/imgcodecs/src/grfmt_jpeg2000.cpp: In member function 'bool cv::Jpeg2KDecoder::readComponent16u(short unsigned int*, void*, int, int, int, int, int)':
/builddir/build/BUILD/opencv-4.3.0/modules/imgcodecs/src/grfmt_jpeg2000.cpp:447:48: error: lvalue required as unary '&' operand
  447 |         jas_seqent_t* pix_row = &jas_matrix_get( buffer, y / ystep, 0 );
      |                                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~


Version-Release number of selected component (if applicable):
4.3.0-9.fc34

Steps to Reproduce:
koji build --scratch f34 opencv-4.3.0-9.fc34.src.rpm

Dependency changes from the last successful build:
https://koschei.fedoraproject.org/build/9103469

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/opencv

Comment 1 Sergio Basto 2020-10-20 08:27:02 UTC
We have a fix from upstream for jasper [1], which is already included in opencv 4.5.0. 
I don't know if we want (or may) update opencv to 4.5.0 . 


[1]
https://github.com/opencv/opencv/commit/f66fc199a20882c546fa31142e9c0f5a8b3cf983
wget https://github.com/opencv/opencv/commit/f66fc199a20882c546fa31142e9c0f5a8b3cf983.patch

Comment 2 Nicolas Chauvet (kwizart) 2020-10-20 09:48:49 UTC
I'm rebuilding the copr opencv4 with opencv 4.5.0, I will can go with opencv 4.5.0 in a side tag for rawhide (only as it's too late for f33), I'm all for it.

Comment 3 Nicolas Chauvet (kwizart) 2020-10-20 13:36:51 UTC
@sergio
Can you push the WIP update you have to opencv git master (without building the update)

I think we only need to fix an issue in opencv (1) and others might be related to fix to the correct includes in apps.


I would use that after tweaking optflags, but seems not needed anymore as -Wl,--as-needed seems the default nowadays, so we could also drop all that.
%global __global_ldflags %(echo %{?__global_ldflags} | sed '/-Wl,--as-needed/!s/$/ -Wl,--as-needed/')


(1) from siri.build.log

make[2]: Leaving directory '/builddir/build/BUILD/siril-0.99.6/src'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libopencv_calib3d.so: undefined reference to symbol '_ZN2cv5flann11IndexParamsD2Ev'
/usr/bin/ld: /usr/lib64/libopencv_flann.so.4.5: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

It probably means libopencv_calib3d.so is missing a library at link time. The error is on the opencv side.

Comment 4 Nicolas Chauvet (kwizart) 2020-10-20 15:55:14 UTC
siri and mrpt are the remaining ones.  Yafaray is red because it "fails" on aarch64 where this arch is excluded.
I've send an email to mrpt maintainers to verify if they can fix and/or update to newer releases.

Comment 5 Sergio Basto 2020-10-20 22:12:33 UTC
(In reply to Nicolas Chauvet (kwizart) from comment #3)
> @sergio
> Can you push the WIP update you have to opencv git master (without building
> the update)

Done

Comment 6 Nicolas Chauvet (kwizart) 2020-10-21 09:31:03 UTC
Okay mrpt is a false positive because it's about missing timeb and related header in glibc that will be reverted.
mrpt also has opencv disabled.

I have a fix for siri, but It's not needed when compiled on fc31 with opencv-4.5, so I'm keeping it in my pocket for now.

Mail sent to devel for the opencv ABI bump