Android, NDK, creating a static library

Is it possible to create a static (.a) library using ndk-build from several other static (.a) libraries.

For example, I have several libraries: lib1.a, lib2.a, lib3.a, and I need to create libmegalib.a lib

Using LOCAL_WHOLE_STATIC_LIBRARIES and enable $ (BUILD_STATIC_LIBRARY) dosn't help. It creates libmegalib.a lib, but contains "! <arch>" only the contents (8 bytes).

But I need libmegalib.a to contain all my libs: lib1.a, lib2.a, lib3.a

+4
source share
1 answer

You can use ar ( arm-linux-androideabi-ar from the corresponding NDK toolchain) to achieve this:

 arm-linux-androideabi-ar -xv lib1.a arm-linux-androideabi-ar -xv lib2.a arm-linux-androideabi-ar -xv lib3.a arm-linux-androideabi-ar -rc libmegalib.a *.o 
+4
source

Source: https://habr.com/ru/post/1398287/


All Articles