简体   繁体   中英

Android, NDK, building static library

Is it possible to build 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 build libmegalib.a lib

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

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

You should be able to use ar ( arm-linux-androideabi-ar from the appropriate 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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