tools:makefile.amCmake编译规则改为Android.bp&ldd&readelf&nm

mac2025-03-05  4

三个可以查看库文件的linux下工具。man或者--help查看更多 readelf nm ldd

关于Android.bp如何使用,查阅androidout目录下的生成doc $ROOT/out/soong/docs

error example:

ld.lld: error: undefined symbol:

链接过程找不到对应函数定义:确定对应链接库函数是否写明。如需置为未定义函数,Android.bp可使用allow_undefined_symbols: true,

Android.bp对应的doc文件:Out/soong/docs/*.html

https://android.googlesource.com/platform/build/soong/+/HEAD/docs/best_practices.md

个人理解 1.Android.bp放在相对上层目录,因为android构建规则不允许../../这样的相对引用。 2.LOCAL_COPY_HEADERS被弃用,如果想将头文件之类export出去,你要手写一个虚拟的库,让别人引用即可。 3.LOCAL_COPY_HEADERS_TO被弃用,想将头文件copy到指定目录,你需要使用cmd命令实现,参考例子$ROOT/libcore/Android.bp#12

6 genrule { 7 name: "notices-for-framework-stubs", 8 tool_files: [ 9 "NOTICE", 10 "ojluni/NOTICE", 11 ], 12 cmd: "cp -f $(location NOTICE) $(genDir)/NOTICES/libcore-NOTICE && cp -f $(location ojluni/NOTICE) $(genDir)/NOTICES/ojluni-NOTICE", 13 out: [ 14 "NOTICES/libcore-NOTICE", 15 "NOTICES/ojluni-NOTICE", 16 ], 17 }

CMake Cmakelists.txt里面的变量都应该能在build/CmakeCache.txt里面有清楚的定义。https://cmake.org/cmake/help/v3.18/guide/tutorial/index.html#id1 以上link,最标准Cmake教程

最新回复(0)