Android NDK, two Static Libraries and Linking

此生再无相见时 提交于 2019-11-29 03:53:25

This looks like an order-of-linking issue to me.

Your command line is:

arm-linux-androideabi-g++ -Wl,-soname,libFinal.so -shared \
  libBase.a libFramework.a libGraphics.a libPlatform.a -o libFinal.so

and the error is

libPlatform.a(ATexture.o): In function `ATexture':
ATexture.cpp:9: undefined reference to `TextureRenderer'
ATexture.cpp:9: undefined reference to `TextureRenderer'

TextureRenderer is in Graphics. But libGraphics is before libPlatform on the command line. g++ will search each library on the command line in the order they are given, loading functions to resolve external references. It will read libGraphics once, load the functions that resolve external references and move on to libPlatform.

Try changing LOCAL_STATIC_LIBRARIES := $(MY_LOCAL_STATIC_LIBRARIES) to LOCAL_STATIC_LIBRARIES := Platform Graphics Framework Base and see how you get on.

In your Android.mk, make sure you are referencing the static library with the proper call:

LOCAL_STATIC_LIBRARIES := mystaticlibproj

before calling include $(BUILD_SHARED_LIBRARY).

Then, at the end of the file, place the call to import the static lib module

$(call import-module, mystaticlibproj)

If you're still having trouble, post the verbose build log (ndk-build V=1 -B) and your Android.mk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!