Android NDK building - Include LOCAL_SHARED_LIBRARIES?

后端 未结 1 1044
一整个雨季
一整个雨季 2021-01-04 13:09

I\'m having problems building a project under the Android NDK. Most likely its due to the proper shared / static libraries not being included. The ones as -lsomeLib I added,

相关标签:
1条回答
  • 2021-01-04 13:33

    It looks to me like you should not be including -lmedia etc in your LOCAL_LDLIBS arguments.

    1. Where does ndk-build actually look for these libraries?

    If you look in $NDK/docs/STABLE-APIS.html you will see that there is a specified set of libraries you can include in this manner. Note:

    The headers corresponding to a given API level are now located under $NDK/platforms/android-<level>/arch-arm/usr/include

    Having looked myself, none of the libraries you specified exist there, although I only looked for API-14.


    2. If I don't include the -lutils -lmedia -lz -lbinder, I am not able to even get to the linker error. I have a feeling including just -LsomeDir and -lsomeLib is not the correct way to add them.

    If your libraries are just regular c/c++ libraries that you would #include you should use LOCAL_C_INCLUDES instead.

    Also note, from $NDK/docs/ANDROID-MK.html:

    • The build system handles many details for you. For example, you don't need to list header files or explicit dependencies between generated files in your Android.mk. The NDK build system will compute these automatically for you.

    In order to use other libraries in my native code, I simply #include it and then specify where to find the headers. Here's my LOCAL_C_INCLUDES:

    LOCAL_C_INCLUDES := $(LOCAL_PATH)/shared/Core/inc \
                        $(LOCAL_PATH)/shared/Model/inc  \
                        $(LOCAL_PATH)/shared/boost/include
    

    I hope this helps.

    0 讨论(0)
提交回复
热议问题