Hi there,
I'm trying to cross-compile depthai-core V3 for Android ARM64-v8a, but despite specifying the Android toolchain and architecture, the build keeps producing x86-64 binaries instead of ARM64.
What I'm trying to do: Build depthai-core V3 as per the latest release, as a shared library for Android devices (ARM64-v8a architecture, API level 28) to integrate into an Android application.
My environment:
CMake command I'm using:
cmake -B build-android-arm64 \
-DCMAKE_TOOLCHAIN_FILE=/pvr/android-ndk-r25c/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-28 \
-DCMAKE_BUILD_TYPE=Release \
-DDEPTHAI_BUILD_EXAMPLES=OFF \
-DDEPTHAI_BUILD_TESTS=OFF \
-DDEPTHAI_BUILD_DOCS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DDEPTHAI_ENABLE_CPR=OFF \
-DDEPTHAI_FORCE_USB2=ON \
-DHUNTER_ENABLED=OFF \
-DDEPTHAI_ENABLE_BACKWARD=OFF \
.
The problem: The build completes, but when I check the resulting binaries with file
or readelf
, they show as x86-64 architecture instead of ARM64. It seems like vcpkg or some dependency resolution is ignoring the Android toolchain and building for the host architecture instead.
What I've tried:
Clean builds (removing build directory completely)
Setting -DVCPKG_MANIFEST_MODE=OFF
Manually exporting CC/CXX to point to NDK compilers
Various combinations of disabling features
Questions:
Is there a recommended way to cross-compile depthai-core for Android?
Are there specific vcpkg configurations needed for Android cross-compilation?
Should I be using a different approach entirely (prebuilt binaries, different build system, etc.)?
Any guidance would be greatly appreciated! Has anyone successfully built depthai-core V3 for Android ARM64?
Thanks in advance!