Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top