NDK, Android MK, how create library without FULL dependency path

2

My android.mk:

    LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := chelper

LOCAL_C_INCLUDES += $(LOCAL_PATH)/ \

LOCAL_SRC_FILES := helper.cpp \

LOCAL_SHARED_LIBRARIES = mymodule

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)

#######################################

include $(CLEAR_VARS)
LOCAL_MODULE := test

#LOCAL_LDFLAGS += -Wl,-rpath -Wl,/data/local/tmp

LOCAL_C_INCLUDES += $(LOCAL_PATH)/
LOCAL_SRC_FILES := test.c
LOCAL_SHARED_LIBRARIES := chelper
include $(BUILD_EXECUTABLE)

$(call import-module,mymodule)

But after run executable ./test on my phone i have error : could not load needed library 'libchelper.so' for '/data/local/tmp/test' (link_image[1963]: 7476 could not load needed library 'C:/User s/Andrey/Documents/Android/other/GoogS/app/src/main/jni//obj/local/armeabi/libmymodule.so' for 'libchelper.so' (load_library[1105]: Library 'C:/Users/Andrey/Docu ments/Android/other/AndInfo/app/src/main/jni//obj/local/armeabi/libmymodule.so' not found))CANNOT LINK EXECUTABLE

Result of readelf -d libchelper.so :

..............
 0x00000004 (HASH)                       0xad4
 0x00000001 (NEEDED)                     Shared library: [C:/Users/Andrey/Documents/Android/other/GoogS/app/src/main/jni//obj/local/armeabi/libmymodule.so]
 0x00000001 (NEEDED)                     Shared library: [liblog.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x00000001 (NEEDED)                     Shared library: [libdl.so]
 0x0000000e (SONAME)                     Library soname: [libchelper.so]
 0x0000001a (FINI_ARRAY)                 0x2ea0
 ............

Why this path C:/Users/Andrey/Documents/Android/other/GoogS/app/src/main/jni//obj/local/armeabi/libmymodule.so is HARDCODED. How delete this path ?

android
android-ndk
ld
asked on Stack Overflow May 26, 2015 by ilw

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0