Skip to content

Conversation

@bc-lee
Copy link
Contributor

@bc-lee bc-lee commented Nov 15, 2025

This PR modifies two ports, cpu-features and opencv4, to re-enable
CpuFeatures support for OpenCV4 on Android using the vcpkg-managed
cpu-features library instead of the vendored copy.

The first commit fixes the cpu-features port by exporting the
ndk_compat target with a proper INSTALL_INTERFACE include directory,
allowing consumers to include cpu-features.h correctly.

The second commit updates the opencv4 port to turn WITH_CPUFEATURES
back on (disabled since February 2022 due to symbol clashes with libraries
like libwebp) and link against CpuFeatures::ndk_compat from vcpkg.

Without this fix, OpenCV4 on Android armeabi-v7a is effectively broken:
it fails to detect NEON support (which is almost mandatory on that arch), causing
a runtime crash with “Missing support for required CPU baseline features.”

Fixes #48265

  • Changes comply with the maintainer guide.
  • SHA512s are updated for each updated download.
  • The "supports" clause reflects platforms that may be fixed by this new version.
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

CpuFeatures::ndk_compat’s generated target never populated
INTERFACE_INCLUDE_DIRECTORIES, so consumers could not include
cpu-features.h. Add an patch that sets an INSTALL_INTERFACE include dir
for ndk_compat so CMake writes the correct metadata.
@bc-lee bc-lee marked this pull request as draft November 15, 2025 21:22
OpenCV now requires NEON on armeabi-v7a, but the port disabled
cpu_features in Feburary 2022 due to symbol clashes with libwebp.
Turn WITH_CPUFEATURES back on, consume cpu-features from vcpkg
(`CpuFeatures::ndk_compat`) instead of the vendored copy,
and add it as Android-only dependency so downstream Android apps
can link successfully.
@bc-lee bc-lee force-pushed the cpu-features-opencv-fix branch 3 times, most recently from 1fcf0c6 to 7b96f66 Compare November 16, 2025 03:25
/Users/vcpkg/Data/work/1/s/scripts/azure-pipelines/../ci.feature.baseline.txt:203:9: error: opencv4[core,openvino]:arm64-osx was unexpectedly a cascading failure because the following dependencies are unavailable: openvino[auto,core,cpu,hetero]:arm64-osx
/Users/vcpkg/Data/work/1/s/scripts/azure-pipelines/../ci.feature.baseline.txt:203:9: note: consider changing this to =cascade instead
@bc-lee bc-lee force-pushed the cpu-features-opencv-fix branch from 7b96f66 to 85c5854 Compare November 16, 2025 04:09
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.

[opencv4][Android] Disabling cpufeatures (-DWITH_CPUFEATURES=OFF) breaks NEON detection and causes runtime crash

1 participant