简体   繁体   中英

Static library cross-dependencies in Android NDK

I'm working on an Android NDK app, which uses a number of static libraries. Some of these static libraries depend on each other ( or the header files specifically ), but there are no circular references. Within the dependent library's Android.mk file, I had thought I would be able to just to use

$(call import-module,#name)

... from one static library to another, but it doesn't seem to work as I get missing header file errors when compiling. So far I have worked around this issue by adding the dependency "include" directories manually to the LOCAL_C_INCLUDES variable, but it feels kind of messy to run up and down the relative paths to the other modules.

It seems like there must be a better way to do this. I know that the LOCAL_EXPORT_C_INCLUDES does work when referencing a static library from my primary shared library ( the one loaded by the NativeActivity ), but it just doesn't seem to work from static library to static library.

Am I just setting this up wrong somehow? Should these modules be able to import each other and get the includes automatically?

It appears that I needed to add the dependency module to the LOCAL_STATIC_LIBRARIES variable of the dependent Android.mk, in addition to importing it. I had assumed that the static library list was just for linking code, but it apparently affects header exports as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM