Skip to content

Linux camera: bundle OpenCV for flatpak, tarball and AppImage (builds on #1404) - #1484

Open
sneurlax wants to merge 9 commits into
stagingfrom
fix/flatpak-opencv-josh
Open

sneurlax wants to merge 9 commits into
stagingfrom
fix/flatpak-opencv-josh

Conversation

@sneurlax

@sneurlax sneurlax commented Nov 1, 2026

Copy link
Copy Markdown
Member

Builds on Dan's #1404 (commit 8ec9f17, unchanged). Linux camera (QR scanning) is broken in every Linux artifact we ship.

Cause

libcamera_linux.so is bundled (since #1317) but needs libopencv_wrapper.so, which the plugin never bundles, plus about 50 host libopencv_*.so.406 libraries, and its RUNPATH points at the CI build tree. It fails to load on any user machine. The flatpak also had no OpenCV and only --device=dri.

Changes on top of #1404

  • Merge of current staging (finish-args keep --device=all and :create).
  • Flatpak: OpenCV installs into /app/lib (it went to lib64 by default), IPP and apps off for an offline build, cleanup of headers and cmake files, WITH_LIBV4L dropped.
  • Flatpak: camera-linux links with -Wl,--no-as-needed, because the SDK's --as-needed dropped its NEEDED on libopencv_wrapper.so and dlsym failed.
  • Tarball and AppImage: scripts/linux/build_opencv_static.sh builds a minimal static OpenCV 4.10 (core, imgproc, imgcodecs, videoio) into the CI image at /opt/opencv-static, and the image no longer installs libopencv-dev.
  • linux/CMakeLists.txt template: reads STACKWALLET_OPENCV_DIR, bundles the wrapper, RUNPATH $ORIGIN, static libstdc++, --exclude-libs,ALL, -Bsymbolic.
  • prepare_release_bundle.py: fails the build if the camera libraries don't load from the bundle; --check-only mode for the AppImage; 7 unit tests.
  • CI: a composite action .github/actions/static-opencv with a cache keyed on the script hash.

Tested, with a real USB webcam (Depstech, /dev/video0)

Artifact Result
Flatpak, this repo's manifest (24.08), built in Docker live preview in the app's QR dialog; native capture 640x480
Tarball libs, Ubuntu 24.04 / Fedora 44 / Debian 13 containers with no OpenCV frame captured, 640x480 JPEG decodes
Tarball libs, Debian 12 doesn't load: libopencv_wrapper.so needs GLIBC_2.38. The bundle already needs 2.39 for libepic_cash_wallet.so, so this isn't new
Host dev build (system OpenCV 4.6) live preview
The bundle check rejects the current staging CI bundle, passes the fixed one

Not tested: Stack Duo and Campfire builds, a real CI run (nothing has gone to GitHub), the AppImage as a whole.

The same changes for release builds are in sneurlax/stack_releases PR (branch fix/flatpak-opencv-camera), because releases generate their own manifest in linux_release.dart.

libopencv-dev in the CI image?

I recommend dropping it, as this branch does. With it installed, camera-linux's find_package(OpenCV) can silently pick the shared system OpenCV, which is exactly how the current broken bundles were produced; without it the only OpenCV in the image is the static one, and the bundle check catches anything else. Developer machines still need libopencv-dev for local flutter run, and that stays in the docs.

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 10.74%. Comparing base (ad1efd5) to head (98e2124).
⚠️ Report is 1 commits behind head on staging.

Additional details and impacted files
@@           Coverage Diff            @@
##           staging    #1484   +/-   ##
========================================
  Coverage    10.74%   10.74%           
========================================
  Files         1132     1132           
  Lines       113993   113993           
========================================
  Hits         12254    12254           
  Misses      101739   101739           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants