ar

How to merge two “ar” static libraries into one?

邮差的信 提交于 2019-11-26 00:25:22
问题 I have 2 static Linux libraries, created by ar cr , libabc.a and libxyz.a . I want to merge them into one static library libaz.a . How can I do this. I want to create a merged static library, not to give both libraries to final link of applications. 回答1: You can extract the object from both the .a files and create your .a file using the extracted .o s: ar -x libabc.a ar -x libxyz.a ar -c libaz.a *.o 回答2: There are at least three ways to do this natively . The first and most portable way is to