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

有帮助吗?

解决方案

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).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top