libfprint-CS9711 icon indicating copy to clipboard operation
libfprint-CS9711 copied to clipboard

no longer working since opencv update to version 5

Open Aurellion opened this issue 4 months ago • 5 comments

Hi, as the title says I can no longer use this driver since opencv was updated to version 5 in arch linux. Downgrading to 4.13 did not work, since reinstalling does not work, for reasons I don´t know. I am hoping for an update or a hint.

Thanks

Aurellion avatar Jul 12 '26 13:07 Aurellion

@Aurellion I encountered the same issue after the OpenCV 5 update on Arch Linux. Here's how I fixed it:

Root Cause

The libfprint-CS9711 source hardcodes dependency('opencv4') in libfprint/sigfm/meson.build, but OpenCV 5 changed its pkg-config name to opencv5.

Fix

Modify the PKGBUILD(~/.cache/paru/clone/libfprint-cs9711-rebase-git/PKGBUILD) to patch the meson.build during the build process:

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -5,7 +5,7 @@
 pkgname=libfprint-cs9711-rebase-git
 _pkgname=libfprint-CS9711
 pkgver=1.94.10+1.r1866.20260216.02b285c
-pkgrel=1
+pkgrel=2
 pkgdesc="libfprint with CS9711 fingerprint driver support (archeYR fork, cs9711-rebase branch)"
 arch=(x86_64)
 url="https://github.com/archeYR/libfprint-CS9711"
@@ -56,6 +56,9 @@ pkgver() {
 }
 
 build() {
+  # Patch for OpenCV 5 compatibility: opencv4 -> opencv5
+  sed -i "s/dependency('opencv4'/dependency('opencv5'/g" "$_pkgname/libfprint/sigfm/meson.build"
+
   local meson_options=(
     -D installed-tests=false
   )

Then rebuild and install:

cd ~/.cache/paru/clone/libfprint-cs9711-rebase-git
rm -rf src/ pkg/
makepkg -si

After installation, restart the fingerprint service:

sudo systemctl restart fprintd
systemctl status fprintd

Hope this helps!

elgca avatar Jul 13 '26 04:07 elgca

Hi, thanks for the reply! I did as you said, but the compile fails at:

Linking target libfprint/libfprint-2.so.2.0.0 FAILED: [code=1] libfprint/libfprint-2.so.2.0.0

Maybe that is caused somewhere else and/or maybe you know what the problem could be.

Aurellion avatar Jul 13 '26 05:07 Aurellion

@Aurellion the sed gets you past configure but always dies at link. Two reasons:

  1. opencv5.pc lists every built module, including opencv_viz and opencv_hdf, which want VTK and HDF5. If those aren't installed you get undefined reference to vtkObject::....
  2. OpenCV 5 renamed features2d to features. The old opencv2/features2d.hpp header still exists, so it compiles fine and only linking catches it.

sigfm only uses five modules, so asking for those via the CMake config instead of pkg-config avoids both. opencv5.patch:

--- a/libfprint/sigfm/meson.build
+++ b/libfprint/sigfm/meson.build
@@ -1,7 +1,13 @@
 
 sigfm_sources = ['sigfm.cpp']
 
-opencv = dependency('opencv4', required: true)
+opencv = dependency('opencv4', required: false)
+if not opencv.found()
+  opencv = dependency('OpenCV',
+    method: 'cmake',
+    modules: ['opencv_core', 'opencv_features', 'opencv_imgcodecs',
+              'opencv_imgproc', 'opencv_flann'],
+    required: true)
+endif
 doctest = dependency('doctest', required: true)
 
 libsigfm = static_library('sigfm',

Probing opencv4 first means it still builds on OpenCV 4.

Put that file next to the PKGBUILD and:

-pkgrel=1
+pkgrel=2
@@
 source=("git+https://github.com/archeYR/libfprint-CS9711.git#branch=cs9711-rebase"
+        "opencv5.patch")
-sha256sums=('SKIP')
+sha256sums=('SKIP'
+            'SKIP')
+
+prepare() {
+  cd "$_pkgname"
+  patch -Np1 -i "$srcdir/opencv5.patch"
+}

Also add cmake to makedepends if it isn't there. Then rm -rf src/ pkg/, makepkg -sif, sudo systemctl restart fprintd.

One more thing that isn't obvious: after this you have to re-enroll. sigfm stores raw SIFT descriptors and the format has no version marker, so old templates from OpenCV 4 still load fine but match against incompatible descriptors. No error, matching just gets bad, and it looks like a dirty sensor. fprintd-enroll -f right-index-finger overwrites in place, then fprintd-verify a few times to check.

If it still won't link, post the actual undefined reference lines and it'll be obvious which of the two it is.

SeriousConcept1134 avatar Jul 28 '26 15:07 SeriousConcept1134

@Aurellion can you please check if #12 fixes the problem for you?

archeYR avatar Aug 12 '26 14:08 archeYR

Should be fixed with sigfm rebase

archeYR avatar Nov 08 '26 14:11 archeYR