FTBFS: opencv fails to build on riscv64

Bug #2130009 reported by Heinrich Schuchardt
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
opencv (Ubuntu)
Confirmed
Low
Valentin Haudiquet

Bug Description

A build failure occurs when building OpenCV on riscv64:
https://launchpad.net/ubuntu/+source/opencv/4.10.0+dfsg-6ubuntu1/+build/31403356

/<<PKGBUILDDIR>>/modules/core/include/opencv2/core/hal/intrin_rvv.hpp: In function ‘void cv::hal_baseline::v_rshr_pack_u_store(uchar*, const v_int16x8&)’:
/<<PKGBUILDDIR>>/modules/core/include/opencv2/core/hal/intrin_rvv_010_compat_non-policy.hpp:18935:53: error: too few arguments to function ‘vuint8m1_t __riscv_vnclipu_wx_u8m1(vuint16m2_t, long unsigned int, unsigned int, long unsigned int)’ [-Wtemplate-body]
18935 | #define vnclipu_wx_u8m1(...) __riscv_vnclipu_wx_u8m1(__VA_ARGS__)
      | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/<<PKGBUILDDIR>>/modules/core/include/opencv2/core/hal/intrin_rvv.hpp:2492:25: note: in expansion of macro ‘vnclipu_wx_u8m1’
 2492 | v_store(ptr, _Tpvec(rshr(cast(vmax_vx_##suffix##m2(vle##width##_v_##suffix##m2(arr, vl), 0, vl)), n, vl))); \
      | ^~~~
/<<PKGBUILDDIR>>/modules/core/include/opencv2/core/hal/intrin_rvv.hpp:2495:1: note: in expansion of macro ‘OPENCV_HAL_IMPL_RVV_PACK_U’
 2495 | OPENCV_HAL_IMPL_RVV_PACK_U(v_uint8x16, uchar, v_int16x8, short, 8, 16, u8, i16, vnclipu_wx_u8m1, vreinterpret_v_i16m2_u16m2, 8, 16)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~

Related branches

summary: - opencv fails to build on riscv64
+ FTBFS: opencv fails to build on riscv64
Graham Inggs (ginggs)
tags: added: ftbfs update-excuse
Changed in opencv (Ubuntu):
assignee: nobody → Valentin Haudiquet (vhaudiquet)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Heinrich Schuchardt (xypron) wrote :

The buildlog shows a failure is the documentation job:

error opening bib17850.bbl: No such file or directory
bibtex command failed: No such file or directory
error: Problems running bibtex. Verify that the command 'perl --version' works from the command line. Exit code: 2

Changed in opencv (Ubuntu):
status: Confirmed → In Progress
Revision history for this message
Valentin Haudiquet (vhaudiquet) wrote (last edit ):

After that bibtex error, there are a lot of RVV-related compile errors, mostly in files like
/<<PKGBUILDDIR>>/modules/core/include/opencv2/core/hal/intrin_rvv*.hpp or .cpp

I wonder if those are related or not. I will first try to fix the RVV failures, then look at BibTeX, thanks for pointing it out :)

For the RVV part, it seems that OpenCV might need some specific flags according to their documentation (https://github.com/opencv/opencv/wiki/OpenCV-RISC-V). I will investigate this further, trying builds in PPA: https://launchpad.net/~vhaudiquet/+archive/ubuntu/opencv-lp2130009/+packages

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

I did force gcc-14 on riscv64 and in 6 hours the build should finish. Please wait to upload until this one is good so we have at least a build for the transition rebuilds

Revision history for this message
Rik Mills (rikmills) wrote :

For the record, Gianfranco's build forcing gcc-14 on riscv64 succeeded, and the package is now migrating to the resolute release pocket. Obviously this bug stays open as we need a fix that does not require such a workaround.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

Fixed with 4.10.0+dfsg-7ubuntu3

Changed in opencv (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Valentin Haudiquet (vhaudiquet) wrote :

I don't believe that this is fixed, I think that one still has the workaround (building with gcc-14). But maybe we should open a separate bug for RVV enablement on OpenCV?

I must admit my previous investigations led me nowhere, so this might require more work...

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

Using gcc-14 is not a fix... reopening

Changed in opencv (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Heinrich Schuchardt (xypron) wrote :

b5ea32158a5f ("Merge pull request #25883 from hanliutong:rvv-intrin-upgrade")
in version 4.11 updated the RISC-V vector intrinsics.

35571be57089 ("Merge pull request #26318 from hanliutong:rvv-intrin-m2")
contains a further upgrade of vector intrinsics in verison 4.11.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

The current upstream release is 4.13.0.

Revision history for this message
Heinrich Schuchardt (xypron) wrote (last edit ):

cmake -DWITH_HAL_RVV=OFF
allows to build without the problematic code.

Revision history for this message
Heinrich Schuchardt (xypron) wrote :

Testing the binaries is possible with 'make test'.

On 4.13.0 there is no difference in the number of failed tests between building with and without vector support.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.