I am trying to build a native library for an Android application. I have 2 libraries and I need to link them in my final library, but I have some problems. The Android.mk code:
LOCAL_CFLAGS := -Wall -Wfloat-equal -std=c99
LOCAL_PATH := $(call my-dir)/..
include $(CLEAR_VARS)
LOCAL_MODULE := cpu-lib
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/cpu/inc
LOCAL_EXPORT_CPPFLAGS := $(LOCAL_CFLAGS)
LOCAL_EXPORT_LDLIBS := -llog
LOCAL_SRC_FILES := $(LOCAL_PATH)/cpu/lib/$(TARGET_ARCH_ABI)/libdemoDSP.so
LOCAL_STATIC_LIBRARIES := gnustl_static
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := dsp-lib
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/dsp/inc
LOCAL_EXPORT_CPPFLAGS := $(LOCAL_CFLAGS)
LOCAL_EXPORT_LDLIBS := -llog
LOCAL_SRC_FILES := $(LOCAL_PATH)/dsp/lib/$(TARGET_ARCH_ABI)/libfn_dsp.so
LOCAL_STATIC_LIBRARIES := gnustl_static
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := process
LOCAL_SRC_FILES := process.cpp
LOCAL_SHARED_LIBRARIES := cpu-lib dsp-lib
include $(BUILD_SHARED_LIBRARY)
The problem is that the dlopen won't find the libfn_dsp.so. The ndk-depends output:
ndk-depends libs\arm64-v8a\libprocess.so
WARNING: Could not find library: ./obj/local/arm64-v8a/libfn_dsp.so
libprocess.so
liblog.so
libdemoDSP.so
libstdc++.so
libm.so
libdl.so
libc.so
./obj/local/arm64-v8a/libfn_dsp.so
It seems that is something strange with that lib. Does somebody know what might be?
The libfn_dsp.so binary was - for whatever reason - built
with rpathwithout SONAME. You can use objdump utility (bundled in Android NDK) to see the proof.If you cannot rebuild this library, follow the discussion here: Can I change 'rpath' in an already compiled binary?.