Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

Circular Dependency of static libraries in Android makefile

$
0
0
We are working on a project where we need to create a shared library from
the static libraries. The issues we are facing is the static libraries
contains a circular dependency. Following is the sample of my makefile:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Mylib1
LOCAL_SRC_FILES := lib/libMylib1.a
include $(PREBUILT_STATIC_LIBRARY)
....
....
....

LOCAL_MODULE := DisplayDriver
LOCAL_SRC_FILES := \
file1.c \
file2.c \
file3.c

LOCAL_STATIC_LIBRARIES := -Wl,--start-group \
Mylib1 \
Mylib2 \
Mylib3 \
Mylib4 \
-Wl,--end-group

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/examples

LOCAL_CFLAGS := -x c -DHAVE_STDINT -DHAVE_SETENV -DNDEBUG -c
LOCAL_LDLIBS += -llog
APP_ABI := armeabi-v7a
include $(BUILD_SHARED_LIBRARY)

When I give the ndk-build V=1 I can see in the output that clearly -Wl,--start-group and -Wl,--end-group is removed from the compilation when it is going to create the shared library. So is there any other flags which is obvious and I am missing the same?

On the other side if I will give it in LOCAL_LDLIBS like -Wl,--start-group $(LOCAL_STATIC_LIBRARIES) -Wl,--end-group, I am able to create the shared library but seeing the following warning:

*Android NDK: WARNING:jni/Android.mk:BasicClient: non-system libraries in linker flags: jni/lib/libA.a jni/lib/libB.a jni/lib/libB.a jni/lib/libC.aAndroid NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES*

*Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the*

. I am using NDK R9, ARM arch.

Thanks in Advance for any inputs!!

Viewing all articles
Browse latest Browse all 6551

Trending Articles