I recently upgraded from libjpeg-turbo 1.5.0 to 3.0.2 and attempted to integrate libturbojpeg.so into an Android Studio project using ndk-build. However, the build process fails during ndkClean or ndk-build.cmd clean with the following error:
Android NDK: ERROR: /UVCCamera/Android.mk:turbojpeg: LOCAL_SRC_FILES points to a missing file Android NDK: Check that /libs/armeabi-v7a/libturbojpeg.so exists or that its path is correct
Despite placing libturbojpeg.so in the correct libs/armeabi-v7a/ and libs/arm64-v8a/ folders, the build process still fails. The integration works when the file is manually copied, but the cleaning process fails unless all ABI .so files are present — even if the build only targets one ABI.
Environment
- libjpeg-turbo version: 3.0.2
- NDK version: 23.1.7779620
- Android Studio version: Hedgehog | Chipmunk
- Gradle plugin: 7.x
- Build system: ndk-build via Gradle (
externalNativeBuild.ndkBuild) - Target ABI: armeabi-v7a and arm64-v8a
- minSdkVersion: 21
Steps to Reproduce
- Build
libturbojpeg.sousing CMake for armeabi-v7a and arm64-v8a - Place
.sofiles into appropriatelibs/<ABI>/folders - Declare
LOCAL_SRC_FILES := ../../libs/$(TARGET_ARCH_ABI)/libturbojpeg.soinAndroid.mk - Run
ndk-build.cmd cleanor./gradlew clean - See error if any one ABI
.sois missing
Expected Behavior
ndkClean should not fail if only the selected APP_ABI is built, or it should provide a clearer fallback mechanism if a .so is not used by the current ABI.
Workaround
- Manually copy
.sofiles into all ABI folders, even if not building for that ABI - Or temporarily limit
APP_ABIto only one target inApplication.mk
Request
Can you please confirm?
- If this behavior is intended?
- If there’s a cleaner way to integrate prebuilt
.sowithout hittingLOCAL_SRC_FILESerrors for unused ABIs? - Whether a default
cmake+ndk-buildintegration sample can be included for Android prebuilt use?
Thank you for your work on this fast and robust JPEG library!