can anyone tell how can I include already existing .a
file while creating .a
with this?
ar rcs libcrypt.a
I need to add libssl.a
and libcrypto.a
files together into a libcrypt.a
file. Can you help me to solve this?
man ar
tells you how to extract
all the members from an archive, and it tells you how to insert members
into an archive.
So extract all the members from libssl.a
and libcrypto.a
and insert them all into libcrypt.a
, taking care to do the extracting
in an empty directory.
$ mkdir scrap
$ cd scrap
$ ar -x ../libssl.a
$ ar -x ../libcrypto.a
$ ar rcs ../libcrypt.a *
$ cd ..
$ rm -r scrap/
ar rcs libcrypt.a libssl.a libcrypto.a
?libssl.a
andlibcrypto.a
into the (new)libcrypt.a
archive. That much would work, but the linker would be looking for.o
files and not complete.a
files in the library; it wouldn't find any symbols inlibcrypt.a
. You have to add the object files as object files. (You can store source code and other files in archives if you wish. Very few people actually do so, but that was originally an intended use for thear
program.)