开发者

android-ndk - using prebuilt static libraries that links with each other

开发者 https://www.devze.com 2023-04-11 17:05 出处:网络
I\'ve got 3 prebuilt static libraries I want to use in my shared library. The problem is when the ndk-build tries to link to the static libraries, I get tons of undefined references thrown at me.

I've got 3 prebuilt static libraries I want to use in my shared library.

The problem is when the ndk-build tries to link to the static libraries, I get tons of undefined references thrown at me. The 'undefined references' originates from when the static libraries tries to call methods in another static library. For example, tinyNET calling a method in tinySAK. The dependencies are this: tinySAK has no dependencies tinyNET depends on tinySAK, tinyHTTP depends on tinyNET and tinySAK

Here's what my Android.mk looks like:

LOCAL_PATH := $(call my-dir)

# TINYSAK
include $(开发者_运维问答CLEAR_VARS)

LOCAL_MODULE    := tinySAK
LOCAL_SRC_FILES := libtinySAK_armv7-a.a

include $(PREBUILT_STATIC_LIBRARY)


# TINYNET
include $(CLEAR_VARS)

LOCAL_MODULE    := tinyNET
LOCAL_SRC_FILES := libtinyNET_armv7-a.a

include $(PREBUILT_STATIC_LIBRARY)



# TINYHTTP
include $(CLEAR_VARS)

LOCAL_MODULE    := tinyHTTP
LOCAL_SRC_FILES := libtinyHTTP_armv7-a.a

include $(PREBUILT_STATIC_LIBRARY)





include $(CLEAR_VARS)

LOCAL_MODULE    := libtest

LOCAL_SRC_FILES := \
/../../testclient.cpp \
/../../main.cpp \
/../../Webservice.cpp 

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../includes/ \
$(LOCAL_PATH)/../../../doubango/tinyHTTP/include/ \
$(LOCAL_PATH)/../../../doubango/tinySAK/src/ \
$(LOCAL_PATH)/../../../doubango/tinyNET/src/ 

LOCAL_STATIC_LIBRARIES := tinySAK tinyNET tinyHTTP

include $(BUILD_SHARED_LIBRARY)

What should I do to fix this?


My god, it was so simple. To any of you with the same problem, heres how I solved it:

Instead of

LOCAL_STATIC_LIBRARIES := tinySAK tinyNET tinyHTTP

Use

LOCAL_STATIC_LIBRARIES := tinyHTTP tinyNET tinySAK

meaning, the one with the most dependencies first.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号