Skip to content

fix msys2 with apothecary packaged opencv4 - #8566

Merged
danoli3 merged 4 commits into
openframeworks:masterfrom
danoli3:msys2-bundled-opencv
Oct 3, 2026
Merged

danoli3 merged 4 commits into
openframeworks:masterfrom
danoli3:msys2-bundled-opencv

Conversation

@danoli3

@danoli3 danoli3 commented Sep 29, 2026

Copy link
Copy Markdown
Member

Link the Apothecary-built OpenCV 4 static libraries on msys2 instead of the pacman opencv package.

  • addons/ofxOpenCv/addon_config.mk: msys2 section lists the bundled archives under libs/opencv/lib/msys2/% (arch wildcard) plus -lzlib, no longer uses pkg-config or excludes the bundled tree
  • scripts/msys2/install_dependencies.sh: stop installing any pacman opencv (pinned 4.x or 5.x fallback) and stop rewriting addon_config.mk

Requires an Apothecary msys2 opencv4 package whose libopencv_world.a defines the core data tables.

The msys2 CI job mixed a pinned system OpenCV 4.13 (via pkg-config)
with the Apothecary-bundled libopencv_world.a, whose objects reference
cv::g_Saturate8u / cv::g_8x32fTab as DLL imports with no DLL present,
failing the allAddonsExample link with undefined symbols.

Use exactly one OpenCV on msys2: the Apothecary-built OpenCV 4 static
libraries bundled under addons/ofxOpenCv/libs/opencv, mirroring how the
Android and Emscripten sections already work.

- addons/ofxOpenCv/addon_config.mk: msys2 section lists the bundled
  static archives explicitly instead of pkg-config opencv4, and no
  longer excludes the bundled headers/libs
- scripts/msys2/install_dependencies.sh: remove the pinned pacman
  OpenCV install, the 5.x fallback, and the addon_config.mk
  pkg-config rewrite

Requires an Apothecary msys2 opencv4 package whose libopencv_world.a
actually defines the core data tables (the 2026-09-28 package's world
archive only carries .refptr imports for them and cannot link).
The Apothecary package lays its static archives out per architecture
(lib/msys2/x86_64, lib/msys2/aarch64, ...). % is expanded to a glob by
the makefile addon parser (and understood by the Project Generator),
so match whichever arch directory the installed package ships instead
of hardcoding x86_64.
MSYS2's zlib package ships libz.a / libz.dll.a, not libzlib, so
-lzlib failed the allAddonsExample link with "cannot find -lzlib".
libzlib.a only exists in the emscripten bundle.
pacman aborts the whole setup-msys2 transaction when one mirror is slow
("Operation too slow ... download library error"), failing the job
before anything builds. Retry the setup once (without the package cache),
and stop one flaky msystem leg from cancelling the others.

Also refresh the stale comment: ofxOpenCv now links the Apothecary-built
OpenCV 4 bundle, not a pinned pacman package.
@danoli3
danoli3 merged commit c5469c0 into openframeworks:master Oct 3, 2026
20 checks passed
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.

1 participant