From 781f7f3c41d1382353596ef58fa5c33cd9064a54 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Tue, 29 Sep 2026 15:01:39 +1000 Subject: [PATCH 1/4] msys2: link Apothecary-built OpenCV 4, drop pacman opencv 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). --- addons/ofxOpenCv/addon_config.mk | 13 ++++---- scripts/msys2/install_dependencies.sh | 43 ++++----------------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/addons/ofxOpenCv/addon_config.mk b/addons/ofxOpenCv/addon_config.mk index 3152f88a24e..4fdcdcd6ed2 100644 --- a/addons/ofxOpenCv/addon_config.mk +++ b/addons/ofxOpenCv/addon_config.mk @@ -93,11 +93,14 @@ linuxaarch64: ADDON_LDFLAGS = -lblas -llapack msys2: - # opencv4 by default; install_dependencies.sh rewrites to opencv5 or opencv if needed - ADDON_PKG_CONFIG_LIBRARIES = opencv4 - ADDON_LIBS_EXCLUDE = libs/opencv/% - ADDON_INCLUDES_EXCLUDE = libs/opencv - ADDON_INCLUDES_EXCLUDE += libs/opencv/% + # Apothecary-built OpenCV 4 static libraries; no system opencv required. + # install_dependencies.sh deliberately installs no opencv package. + ADDON_LIBS = + ADDON_LIBS += libs/opencv/lib/msys2/x86_64/libopencv_world.a + ADDON_LIBS += libs/opencv/lib/msys2/x86_64/liblibprotobuf.a + ADDON_LIBS += libs/opencv/lib/msys2/x86_64/libittnotify.a + ADDON_LIBS += libs/opencv/lib/msys2/x86_64/liblibpng.a + ADDON_LDFLAGS = -lzlib android/x86: ADDON_LIBS = diff --git a/scripts/msys2/install_dependencies.sh b/scripts/msys2/install_dependencies.sh index 88bf9c479ac..08871dd4879 100755 --- a/scripts/msys2/install_dependencies.sh +++ b/scripts/msys2/install_dependencies.sh @@ -149,7 +149,8 @@ echo "using pacman: $PACMAN" MSYS_PACKAGES="unzip make" # List of MINGW packages to be installed (without prefix) -# opencv is pinned separately below (prefer 4.x; ofxOpenCv also compiles against 5) +# NB: no opencv here — ofxOpenCv uses the Apothecary-built static libraries +# bundled under addons/ofxOpenCv/libs/opencv (see below) MINGW_PACKAGES="assimp cairo curl freeimage \ glew glfw glm fmt zlib brotli libpng \ harfbuzz libsndfile libusb libxml2 mpg123 \ @@ -205,42 +206,10 @@ if [ $exit_code != 0 ]; then fi -# Prefer the last 4.x build (smaller / known-good). ofxOpenCv has an OpenCV 5 -# compatibility layer, so falling back to current "opencv" (5.x) still compiles. -# MSYS2's unpinned "opencv" package now resolves to 5.x. -OPENCV4_PKG_VERSION="4.13.0-7" -OPENCV_REPO="${msystem:-ucrt64}" -OPENCV4_PKG_FILE="${MINGW_PACKAGE_PREFIX}-opencv-${OPENCV4_PKG_VERSION}-any.pkg.tar.zst" -OPENCV4_PKG_URL="https://repo.msys2.org/mingw/${OPENCV_REPO}/${OPENCV4_PKG_FILE}" -echo "Installing pinned OpenCV 4 from $OPENCV4_PKG_URL" -OPENCV_FLAGS=(-U --needed) -[[ "$FORCE_YES" == "1" ]] && OPENCV_FLAGS+=(--noconfirm) -"$PACMAN" "${OPENCV_FLAGS[@]}" "$OPENCV4_PKG_URL" -exit_code=$? -if [ $exit_code != 0 ]; then - echo "error installing pinned OpenCV 4 from $OPENCV4_PKG_URL" - echo "repo.msys2.org is up; that exact filename may have been removed." - echo "falling back to current ${MINGW_PACKAGE_PREFIX}-opencv from the synced database" - "$PACMAN" "${PACMAN_FLAGS[@]}" "${MINGW_PACKAGE_PREFIX}-opencv" || { - echo "error installing opencv — try: pacman -Syu" - exit 1 - } -fi - - -# Update addon_config.mk files to use OpenCV 5, 4 or 3 depending on what's installed -ADDONS_DIR="$(cd "$SCRIPT_DIR/../../addons" && pwd)" -ADDON_CONFIG="$ADDONS_DIR/ofxOpenCv/addon_config.mk" -if pkg-config opencv5 --exists; then - echo "Updating ofxOpenCV to use openCV5" - sed -i -E 's/(ADDON_PKG_CONFIG_LIBRARIES =.*)\bopencv[45]?\b/\1opencv5/' "$ADDON_CONFIG" -elif pkg-config opencv4 --exists; then - echo "Updating ofxOpenCV to use openCV4" - sed -i -E 's/(ADDON_PKG_CONFIG_LIBRARIES =.*)\bopencv[45]?\b/\1opencv4/' "$ADDON_CONFIG" -else - echo "Updating ofxOpenCV to use openCV3" - sed -i -E 's/(ADDON_PKG_CONFIG_LIBRARIES =.*)\bopencv[45]?\b/\1opencv/' "$ADDON_CONFIG" -fi +# OpenCV is intentionally NOT installed from pacman here. +# ofxOpenCv links the Apothecary-built OpenCV 4 static libraries bundled under +# addons/ofxOpenCv/libs/opencv (see the msys2 section of addon_config.mk), +# so no system opencv (4.x, 5.x, pinned or otherwise) is required. if [[ "${FROM_MSYS_SHELL:-0}" == "1" ]]; then echo "done — open MSYS2 UCRT64 to compile" From 4c296b718a38e60d102b15eba4a6af5783ec97af Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Tue, 29 Sep 2026 15:05:24 +1000 Subject: [PATCH 2/4] ofxOpenCv: use arch wildcard for msys2 bundled libs 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. --- addons/ofxOpenCv/addon_config.mk | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/ofxOpenCv/addon_config.mk b/addons/ofxOpenCv/addon_config.mk index 4fdcdcd6ed2..6baf0a87307 100644 --- a/addons/ofxOpenCv/addon_config.mk +++ b/addons/ofxOpenCv/addon_config.mk @@ -95,11 +95,13 @@ linuxaarch64: msys2: # Apothecary-built OpenCV 4 static libraries; no system opencv required. # install_dependencies.sh deliberately installs no opencv package. + # % expands to the architecture directory shipped by the package + # (x86_64, aarch64, ...), so this works for every msystem. ADDON_LIBS = - ADDON_LIBS += libs/opencv/lib/msys2/x86_64/libopencv_world.a - ADDON_LIBS += libs/opencv/lib/msys2/x86_64/liblibprotobuf.a - ADDON_LIBS += libs/opencv/lib/msys2/x86_64/libittnotify.a - ADDON_LIBS += libs/opencv/lib/msys2/x86_64/liblibpng.a + ADDON_LIBS += libs/opencv/lib/msys2/%/libopencv_world.a + ADDON_LIBS += libs/opencv/lib/msys2/%/liblibprotobuf.a + ADDON_LIBS += libs/opencv/lib/msys2/%/libittnotify.a + ADDON_LIBS += libs/opencv/lib/msys2/%/liblibpng.a ADDON_LDFLAGS = -lzlib android/x86: From d01d43980c5954cd57281cef28328484891b5e29 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Thu, 1 Oct 2026 00:42:01 +1000 Subject: [PATCH 3/4] ofxOpenCv: link msys2 zlib as -lz 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. --- addons/ofxOpenCv/addon_config.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/ofxOpenCv/addon_config.mk b/addons/ofxOpenCv/addon_config.mk index 6baf0a87307..18819d33c3b 100644 --- a/addons/ofxOpenCv/addon_config.mk +++ b/addons/ofxOpenCv/addon_config.mk @@ -102,7 +102,8 @@ msys2: ADDON_LIBS += libs/opencv/lib/msys2/%/liblibprotobuf.a ADDON_LIBS += libs/opencv/lib/msys2/%/libittnotify.a ADDON_LIBS += libs/opencv/lib/msys2/%/liblibpng.a - ADDON_LDFLAGS = -lzlib + # zlib comes from the msys2 pacman package (libz.a), not the bundle + ADDON_LDFLAGS = -lz android/x86: ADDON_LIBS = From e34d344bc31ccb66d958fd9bccc54fdce2270fe8 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Fri, 2 Oct 2026 19:06:11 +1000 Subject: [PATCH 4/4] ci: retry msys2 setup when a mirror stalls 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. --- .github/workflows/of.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/of.yml b/.github/workflows/of.yml index 300156523ab..1a5ae4f7c94 100644 --- a/.github/workflows/of.yml +++ b/.github/workflows/of.yml @@ -62,6 +62,7 @@ jobs: build-msys2: runs-on: windows-latest strategy: + fail-fast: false matrix: msystem: - mingw64 @@ -81,15 +82,29 @@ jobs: with: # key: ${{ matrix.os }}-${{ matrix.type }} key: ${{ matrix.msystem }} + # pacman aborts the whole transaction when one mirror stalls + # ("Operation too slow"), so retry the setup once before failing. - uses: msys2/setup-msys2@v2 + id: msys2 + continue-on-error: true with: cache: true release: true update: true msystem: ${{matrix.msystem}} - # opencv is intentionally left out here and pinned to a 4.x build by - # scripts/msys2/install_dependencies.sh (ofxOpenCv isn't ported to - # OpenCV 5's C++-only API yet, and MSYS2's opencv package is now 5.x) + # no opencv package: ofxOpenCv links the Apothecary-built OpenCV 4 + # static libs bundled in addons/ofxOpenCv/libs/opencv + pacboy: openssl:p python:p gcc:p assimp:p cairo:p curl:p freeglut:p freeimage:p glew:p glfw:p glm:p libsndfile:p libusb:p libxml2:p mpg123:p nlohmann-json:p openal:p pugixml:p rtaudio:p uriparser:p utf8cpp:p + install: >- + unzip + make + - uses: msys2/setup-msys2@v2 + if: steps.msys2.outcome == 'failure' + with: + cache: false + release: true + update: true + msystem: ${{matrix.msystem}} pacboy: openssl:p python:p gcc:p assimp:p cairo:p curl:p freeglut:p freeimage:p glew:p glfw:p glm:p libsndfile:p libusb:p libxml2:p mpg123:p nlohmann-json:p openal:p pugixml:p rtaudio:p uriparser:p utf8cpp:p install: >- unzip