Android : merging static libraries into single one

我的未来我决定 提交于 2019-12-12 17:01:10

问题


I use Android NDK r8 to generate multiple static libraries with include $(BUILD_STATIC_LIBRARY) and I successfully get : lib1.a, lib2.a, lib3.a, etc.

Now I would like to merge these static libraries into single one.

I try do it with ar.exe from Android NDK :

android-ndk-r8\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\arm-linux-androideabi\bin\ar.exe r libALL.a lib1.a lib2.a lib3.a

But when I use libAll.a into Android NDK makefile, it fails saying there is no index.

How can I add this index ?

Other question :

When I display contents of archive libAll.a, I see lib1.a, lib2.a, lib3.a instead of .o symbols from these libraries.

How can I change that (= extract .o from static libraries to merge it in libAll.a) ?

Thanks


回答1:


ar is simply an archiving tool like zip. It takes the given input files and produces an .aarchive. If you want to include all .ofiles in a single archive, you have to specify each individual file. I don't know how to do this on WIndows, but on Linux you can use somthing like ar rs $(find . -name *.o).



来源:https://stackoverflow.com/questions/14600809/android-merging-static-libraries-into-single-one

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!