简体   繁体   English

Android NDK中的静态库交叉依赖关系

[英]Static library cross-dependencies in Android NDK

I'm working on an Android NDK app, which uses a number of static libraries. 我正在开发一个使用大量静态库的Android NDK应用程序。 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 在依赖库的Android.mk文件中,我曾以为我可以使用

$(call import-module,#name) $(调用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. 到目前为止,我已经通过将依赖项“ include”目录手动添加到LOCAL_C_INCLUDES变量中来解决此问题,但是上下运行到其他模块的相对路径感觉有些混乱。

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. 我知道从我的主共享库(由NativeActivity加载的那个)引用静态库时,LOCAL_EXPORT_C_INCLUDES确实可以工作,但似乎在静态库与静态库之间似乎都无效。

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. 似乎除了导入它之外,我还需要将依赖项模块添加到从属Android.mk的LOCAL_STATIC_LIBRARIES变量中。 I had assumed that the static library list was just for linking code, but it apparently affects header exports as well. 我以为静态库列表仅用于链接代码,但它显然也会影响标头导出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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