Skip to content

Commit c6fd4df

Browse files
committed
fix(item B): windows-path pkg-config so cmake PKG_CONFIG_FOUND=true
Root cause (verified vs OpenCV 5.0.0 detect_ffmpeg.cmake): the pkg-config FFmpeg branch is NOT windows-gated and DOES run under OPENCV_FFMPEG_SKIP_DOWNLOAD — but only if PKG_CONFIG_FOUND. Prior run passed a git-bash /c/ unix path to PKG_CONFIG_EXECUTABLE which cmake-on-windows rejects → PKG_CONFIG_FOUND=false → branch skipped → FFMPEG:NO. Fix: cygpath -w (windows path) + pkgconfiglite on the native PATH. Not the deep 'OpenCV prefers prebuilt dll' wall — a path-style bug.
1 parent acdff27 commit c6fd4df

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/snapshot-windows-opencv.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
choco install -y --no-progress nasm ninja llvm pkgconfiglite | Out-Null
2323
echo "C:\Program Files\NASM" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
2424
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
25+
# pkgconfiglite installs pkg-config.exe to the choco bin — put it on the
26+
# NATIVE windows PATH so cmake's find_package(PkgConfig) sets PKG_CONFIG_FOUND
27+
echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
28+
Get-Command pkg-config | Select-Object -ExpandProperty Source
2529
- name: build shared FFmpeg 8.1.2 prefix (MSVC) for cmake videoio discovery
2630
shell: msys2 {0}
2731
run: |
@@ -59,16 +63,19 @@ jobs:
5963
set -eux
6064
# windows-native pkg-config (pkgconfiglite) + the ffmpeg prefix's .pc; skip
6165
# OpenCV's prebuilt-dll download so it uses our built shared FFmpeg.
62-
export PKG_CONFIG="$(command -v pkg-config)"
66+
# Pass a WINDOWS-style path to cmake (a /c/ unix path leaves PKG_CONFIG_FOUND
67+
# false → OpenCV's pkg-config FFmpeg branch never runs). PKG_CONFIG_PATH is
68+
# inherited by cmake's pkg-config invocations.
69+
PKGCFG_WIN="$(cygpath -w "$(command -v pkg-config)")"
6370
export PKG_CONFIG_PATH="C:/ffprefix/lib/pkgconfig"
64-
echo "pkg-config: $PKG_CONFIG"; ls -la C:/ffprefix/lib/pkgconfig/ || true
65-
"$PKG_CONFIG" --exists libavcodec libavformat libavutil libswscale \
66-
&& echo "pkg-config sees ffmpeg: avcodec $("$PKG_CONFIG" --modversion libavcodec)" \
71+
echo "pkg-config (win path): $PKGCFG_WIN"; ls -la C:/ffprefix/lib/pkgconfig/ || true
72+
pkg-config --exists libavcodec libavformat libavutil libswscale \
73+
&& echo "pkg-config sees ffmpeg: avcodec $(pkg-config --modversion libavcodec)" \
6774
|| echo "WARN pkg-config missing some ffmpeg .pc"
6875
cmake -G Ninja -S "$OPENCV_SRC" -B bld \
6976
-DCMAKE_BUILD_TYPE=Release \
7077
-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl \
71-
-DPKG_CONFIG_EXECUTABLE="$PKG_CONFIG" \
78+
-DPKG_CONFIG_EXECUTABLE="$PKGCFG_WIN" \
7279
-DBUILD_LIST=core,imgproc,imgcodecs,highgui,videoio \
7380
-DBUILD_SHARED_LIBS=OFF -DBUILD_ZLIB=ON -DBUILD_PNG=ON -DBUILD_JPEG=ON \
7481
-DENABLE_LIBJPEG_TURBO_SIMD=OFF \

0 commit comments

Comments
 (0)