Skip to content

[opencv4:android] build failure (folder /include is empty or not present) #11229

@pthom

Description

@pthom

When building opencv4 for android, the compilation and "cmake install" steps succeed.
However, after this, vcpkg will complain that "The folder /include is empty or not present".

This seems to be due to the fact that opencv emits a non standard include folder hierarchy: see below.

Host Environment

  • Host OS: Linux, ubuntu 18.04
  • Target OS: Android armeabi-v7a
  • Compiler: android-ndk / May 2020

To Reproduce

  1. Cherry-pick a PR that fixes an issue for protobuf under android: [protobuf] Correct protobuf under android (Fix issue #8218) #11228

(I submitted this PR a few minutes ago)

  1. Use this triplet file:

triplets/android-armeabi-v7a.cmake

set(VCPKG_TARGET_ARCHITECTURE arm)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Android)

set(ANDROID_NDK_HOME $ENV{ANDROID_NDK_HOME})
if ("${ANDROID_NDK_HOME}" MATCHES "^$")
  message(FATAL_ERROR 
    "Please set an env variable ANDROID_NDK_HOME pointing to your ndk-bundle folder. 
    For example: export ANDROID_NDK_HOME=/home/your-account/Android/Sdk/ndk-bundle")
endif()
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE ${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake)

set(ANDROID_ABI armeabi-v7a)
# ANDROID_ABI can be : "armeabi-v7a" , "armeabi-v7a with NEON", "arm64-v8a", "x86" or "x86_64"
  1. Download and install the android ndk-bundle

  2. Set an env var to the ndk-bundle folder

export ANDROID_NDK_HOME=/home/your-account/Android/Sdk/ndk-bundle
  1. Build the opencv4 package
./vcpkg install "opencv4[core]:android-armeabi-v7a"

Failure logs

-- Installing: .../vcpkg/packages/opencv4_android-armeabi-v7a/share/opencv4/copyright
-- Performing post-build validation
The folder /include is empty or not present. This indicates the library was not correctly installed.
The following files are placed in
.../vcpkg/packages/opencv4_android-armeabi-v7a:

    .../vcpkg/packages/opencv4_android-armeabi-v7a/README.android

Files cannot be present in those directories.

The following files are placed in
.../vcpkg/packages/opencv4_android-armeabi-v7a/debug:

    .../vcpkg/packages/opencv4_android-armeabi-v7a/debug/README.android

Files cannot be present in those directories.

Found 3 error(s). Please correct the portfile:
    ../vcpkg/ports/opencv4/portfile.cmake
-- Performing post-build validation done
Error: Building package opencv4:android-armeabi-v7a failed with: POST_BUILD_CHECKS_FAILED

-Cut and past the appropriate build messages from the console output.
-Please attach any additional failure logs mentioned in the console output.

Additional context

Please note that this issue can only be reproduced after applying a patch on protobuf package for android

Metadata

Metadata

Assignees

Labels

category:port-bugThe issue is with a library, which is something the port should already support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions