Bug 2051193 - opencv fails to build with java-17-openjdk
Summary: opencv fails to build with java-17-openjdk
Keywords:
Status: CLOSED DUPLICATE of bug 2041573
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2024265
TreeView+ depends on / blocked
 
Reported: 2022-02-06 15:26 UTC by jiri vanek
Modified: 2022-02-15 16:48 UTC (History)
28 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-02-13 19:30:50 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description jiri vanek 2022-02-06 15:26:23 UTC
opencv fails to build with java-17-openjdk as sytem JDK. See https://fedoraproject.org/wiki/Changes/Java17 .
See especially part about known failures: https://fedoraproject.org/wiki/Changes/Java17#common_issues_packagers_can_face_and_gathered_solutions

For the build logs, see: https://koji.fedoraproject.org/koji/taskinfo?taskID=82432549
https://kojipkgs.fedoraproject.org/work/tasks/2732/82432732/mock_output.log
https://kojipkgs.fedoraproject.org/work/tasks/2732/82432732/hw_info.log
https://kojipkgs.fedoraproject.org/work/tasks/2732/82432732/state.log
https://kojipkgs.fedoraproject.org/work/tasks/2732/82432732/build.log
https://kojipkgs.fedoraproject.org/work/tasks/2732/82432732/root.log
We run the rebuild in side tag f36-java17, but as fail ratio was small, we expect this side tag to be merged into rawhide 7 or 8 of February 2022.
To reproduce before this date simply: fedpkg clone opencv; cd opencv;  fedpkg build --target f36-java17; #The target is crucial.
After this date the usual fedpkg build in f36 and up should do.

We run two reruns your package failed both.

We had also run the mass rebuilds in copr since November. We keep all encountered failures. See them here: https://copr.fedorainfracloud.org/coprs/jvanek/java17//package/opencv
You may find interesting additional informations here. Also we were spamming maintainers regualrly, check you spam folder.
              

We had tried aprox 500 packages, and aprox 65 had failed, so the java-17-openjdk will be system JDK in f36, and you should fix your package if you want to keep it alive. Usually the fix is simple, and best is to update the package to latest upstream version.
There will be usual mass rebuild once f36 branches. You may got another FTBFS bug.
Let us know here if you have any questions, here in bug, or at java-devel.org .

We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side if needed.

Comment 1 jiri vanek 2022-02-06 15:59:48 UTC
builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:909:30: note: overloaded builtin '__builtin_vec_vadu' is implemented by builtin '__builtin_altivec_vaduh'
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp: In function 'unsigned int cv::hal_baseline::v_reduce_sad(const v_uint32x4&, const v_uint32x4&)':
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:922:34: error: '__builtin_altivec_vaduw' requires the '-mcpu=power9' and '-mvsx' options
  922 |     const vec_uint4 ad = vec_absd(a.val, b.val);
      |                                  ^
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:922:34: note: overloaded builtin '__builtin_vec_vadu' is implemented by builtin '__builtin_altivec_vaduw'
gmake[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:134: modules/core/CMakeFiles/opencv_core.dir/src/arithm.cpp.o] Error 1
gmake[2]: Leaving directory '/builddir/build/BUILD/opencv-4.5.5/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:4845: modules/core/CMakeFiles/opencv_core.dir/all] Error 2


looks like gcc12 issue

Comment 2 Sergio Basto 2022-02-07 13:13:15 UTC
yes , this is gcc12 with altivec on ppc64le , reference : https://github.com/opencv/opencv/issues/19020#issuecomment-1030940303

The recent updates of GCC12 (pre-release) bring this problem again 

https://kojipkgs.fedoraproject.org/work/tasks/9006/82469006/build.log
build are done with LTO disabled 


```
[  1%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp.o
/usr/bin/g++ -DVK_NO_PROTOTYPES -I/builddir/build/BUILD/opencv-4.5.5/redhat-linux-build -I/usr/include/vulkan -I/builddir/build/BUILD/opencv-4.5.5/redhat-linux-build/3rdparty/ade/ade-0.1.1f/sources/ade/include -isystem /usr/include/gdal -isystem /usr/include/coin -isystem /usr/include/openblas -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mcpu=power8 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -fPIC -std=c++11 -MD -MT CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp.o -MF CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp.o.d -o CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp.o -c /builddir/build/BUILD/opencv-4.5.5/redhat-linux-build/3rdparty/ade/ade-0.1.1f/sources/ade/source/passes/communications.cpp
In file included from /builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin.hpp:223,
                 from /builddir/build/BUILD/opencv-4.5.5/modules/core/src/precomp.hpp:88,
                 from /builddir/build/BUILD/opencv-4.5.5/modules/core/src/algorithm.cpp:43:
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp: In function 'unsigned int cv::hal_baseline::v_reduce_sad(const v_uint8x16&, const v_uint8x16&)':
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:897:40: error: '__builtin_altivec_vadub' requires the '-mcpu=power9' and '-mvsx' options
  897 |     vec_uint4 sum4 = vec_sum4s(vec_absd(a.val, b.val), zero4);
      |                                        ^
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:897:40: note: overloaded builtin '__builtin_vec_vadu' is implemented by builtin '__builtin_altivec_vadub'
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp: In function 'unsigned int cv::hal_baseline::v_reduce_sad(const v_uint16x8&, const v_uint16x8&)':
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:909:30: error: '__builtin_altivec_vaduh' requires the '-mcpu=power9' and '-mvsx' options
  909 |     vec_ushort8 ad = vec_absd(a.val, b.val);
      |                              ^
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:909:30: note: overloaded builtin '__builtin_vec_vadu' is implemented by builtin '__builtin_altivec_vaduh'
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp: In function 'unsigned int cv::hal_baseline::v_reduce_sad(const v_uint32x4&, const v_uint32x4&)':
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:922:34: error: '__builtin_altivec_vaduw' requires the '-mcpu=power9' and '-mvsx' options
  922 |     const vec_uint4 ad = vec_absd(a.val, b.val);
      |                                  ^
/builddir/build/BUILD/opencv-4.5.5/modules/core/include/opencv2/core/hal/intrin_vsx.hpp:922:34: note: overloaded builtin '__builtin_vec_vadu' is implemented by builtin '__builtin_altivec_vaduw'


```
 I also found this notes : 
On Wed, 2020-07-29 at 12:19 -0500, Steven Munroe wrote:
> Jeff Law wrote:
> 
> > For ppc64le is that the build was done with p8, but there is one
> > function (__builtin_altivec_vadub) that requires p9. This seems
> > like a package bug at first glance, not an LTO issue.
> 
> Yup __builtin_altivec_vadub is POWER9_VECTOR only.
> 
> For P8/6 use something like this:
> 
>   vmin = vec_min (a, b);
>   vmax = vec_max (a, b);
>   result = vec_sub (vmax, vmin);
> 
> executes in 4 cycles.

Comment 3 Jakub Jelinek 2022-02-07 13:29:34 UTC
So, is that
const vec_uint4 ad = vec_absd(a.val, b.val);
in a function compiled for -mcpu=power9?
If not, that would be an OpenCV bug, not GCC.
The vabsdub instruction really is in the Power9 ISA.

Comment 4 Ben Cotton 2022-02-08 20:09:24 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 5 Mamoru TASAKA 2022-02-13 13:46:06 UTC
For now, workaround submitted as PR: https://src.fedoraproject.org/rpms/opencv/pull-request/15
scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=82767561

Workaround is to force defining CV_FORCE_SIMD128_CPP on ppc64le so as NOT to use intrin_vsx.hpp .

Comment 6 Sergio Basto 2022-02-13 19:30:50 UTC
(In reply to Mamoru TASAKA from comment #5)
> For now, workaround submitted as PR:
> https://src.fedoraproject.org/rpms/opencv/pull-request/15
> scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=82767561
> 
> Workaround is to force defining CV_FORCE_SIMD128_CPP on ppc64le so as NOT to
> use intrin_vsx.hpp .

Many thanks for this fix , I will send to upstream

Comment 7 Chip Kerchner 2022-02-15 16:38:21 UTC
Instead of disabling the vectorization for PPC with your workaround, you should instead use this patch

https://github.com/opencv/opencv/pull/21614

Comment 8 Sergio Basto 2022-02-15 16:48:04 UTC
I already did

*** This bug has been marked as a duplicate of bug 2041573 ***


Note You need to log in before you can comment on or make changes to this bug.