Issue
I have now wasted two days on this. Any pointers in resolving the issue would really be helpfull. My Android.mk file is as below. The issue is that libst.so should link as a system so with my executable opti. But when i open the execuatble in an Hex it lists the complete path to the so file libst.so. While the other dependent so files are listed correctly. This results in CANNOT LINK EXECUTABLE error finally since the so file is being searched in the local path e.g.
/media/ExtHDD/NIEL/OPTI/TEST/optimize/workspace/android/obj/local/armeabi-v7a/libst.so" not found rather than searching for inside /system/lib/libst.so where it should ideally look for.
Any pointers or suggestions will be of great help. Thanks.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
SRC_PATH := ${LOCAL_PATH}/../../..
LOCAL_MODULE := libsmp
LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/libs_beta/armeabi-v7a/libsmp.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ARM_NEON := true
LOCAL_MODULE := libocv
LOCAL_SRC_FILES := ${LOCAL_PATH}/lib/libs_beta/armeabi-v7a/libOCv.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libst
LOCAL_SRC_FILES := ${LOCAL_PATH}/lib/libs_beta/armeabi-v7a/libst.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := opti
LOCAL_SRC_FILES := \
$(SRC_PATH)/main.cpp \
LOCAL_C_INCLUDES += \
$(SRC_PATH) \
$(SRC_PATH)/util \
$(SRC_PATH)/src \
$(LOCAL_PATH)/lib/include_beta \
$(LOCAL_PATH)/lib/include_beta/opencv \
$(LOCAL_PATH)/lib/include_beta/opencv2
LOCAL_SHARED_LIBRARIES += libc libsmp libocv libst
LOCAL_CFLAGS += -std=c++11 -fopenmp -fpermissive -mfloat-abi=softfp -mfpu=neon -flax-vector-conversions
LOCAL_LDLIBS += -llog -L$(SYSROOT)/usr/lib
LOCAL_CFLAGS += -fPIE
LOCAL_LDFLAGS += -fPIE -pie
include $(BUILD_EXECUTABLE)
Solution
So, it seems that so files which have some dependency between them cannot be resolved using android-ndk build. In this case when i got the project under the android source tree and built it exe was correctly generated. I also had to change the mk file from the above as below everything worked fine.
LOCAL_MODULE := libst
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_TAGS := optional
#32 bit
LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := lib/$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX)
LOCAL_MULTILIB := both
include $(BUILD_MULTI_PREBUILT)
include $(CLEAR_VARS)
Answered By - Niel
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.