Unable to build CNSDK sample app with multiple ABIs

For integration in a real-world app that ships with the both arm64-v8a and armeabi-v7a libs, it would also be necessary for the CNSDK to seamlessly build and run on either 64bit or 32bit hardware. Unfortunately, attempting to include armeabi-v7a support in the CNSDK sample app fails.

Steps to reproduce

  • In CNSDK sample app build.gradle change line 14
    from
    ndk.abiFilters 'arm64-v8a'
    to
    ndk.abiFilters 'arm64-v8a', "armeabi-v7a"
  • Run menu item Build > Build Bundle(s) / APK(s) > Build APK(s)

Will observe build failure with error:

C/C++: debug|armeabi-v7a :CMake Error at CMakeLists.txt:7 (find_package):
C/C++: debug|armeabi-v7a :  Could not find a configuration file for package "CNSDK" that is compatible
C/C++: debug|armeabi-v7a :  with requested version "".
C/C++: debug|armeabi-v7a :  The following configuration files were considered but not accepted:
C/C++: debug|armeabi-v7a :    <...>/CNSDKGettingStartedGLAndroidNative/build/cnsdk-android-0.7.28/share/cmake/CNSDK/CNSDKConfig.cmake, version: 0.7.28 (64bit)

Note the (64bit) at the end of the last error line, possibly need to explicitly set up for 32 bit ABI build

P.S. Obviously 64 bit is the future and no upcoming Leia products will be 32 bit, so why is this important? Because developers considering adopting CNSDK for optional support of Leia hardware in their own apps, which probably build for all 4 supported ABIs (arm64-v8a, armeabi-v7a, x86_64, x86), would not want their apps in the field to face any breakage due to missing ABIs in Leia’s CNSDK. In fact, not only should CNSDK ship with working armeabi-v7a support, it should ideally also bundle x86_64 and x86 libs as well. Again, this is not about Leia hardware, it’s about seamless integration with 3rd party apps which may well target older devices, chromebooks on Intel chips, etc., and which would benefit from also supporting stereo 3D when running on Leia hardware (my guess is this would be as simple as adding the ABIs in ndk.abiFilters of the CNSDK build gradle files, with no source code modifications required)

1 Like

Looking at file

build/cnsdk-android-0.7.28/share/cmake/CNSDK/CNSDKTargets-release.cmake

the only ABI mentioned is arm64-v8a i.e.

  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/arm64-v8a/libleiaSDK-faceTrackingInService.so"

So fix could be as simple as checking the cmake scripts in build/cnsdk-android-0.7.28/share/cmake to make sure other ABIs point to their respective .so libs

In file

build/cnsdk-android-0.7.28/share/cmake/CNSDK/CNSDKTargets-release.cmake

tried replacing arm64-v8a with ${CMAKE_ANDROID_ARCH_ABI} i.e.

  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${CMAKE_ANDROID_ARCH_ABI}/libleiaSDK-faceTrackingInService.so"
...
list(APPEND _cmake_import_check_files_for_CNSDK::leiaSDK-faceTrackingInService-shared "${_IMPORT_PREFIX}/lib/${CMAKE_ANDROID_ARCH_ABI}/libleiaSDK-faceTrackingInService.so" )

but that didn’t seem to help, fails with same error when building on 32 bit ARM device