Re: AR - append archive to archive
Re: AR - append archive to archive
- Subject: Re: AR - append archive to archive
- From: Kevin Harris <email@hidden>
- Date: Wed, 21 Sep 2005 15:02:38 -0600
On Wed, 2005-09-21 at 12:29 +1000, Andrew White wrote:
> I'm trying to append the contents of one archive file to another. AR will
> add the two archives, but not update the symbol table of the receiving archive.
>
> Eg:
>
> % ar -rs big.a file1.o file2.o small.a
<snip>
> As a workaround, I've changed my code to:
> cp small.a big.a
> ar -rs big.a file1.o file2.o
>
> This works, but obviously is not a general solution.
>
> Any suggestions?
Yes. Extract the members of all source archives (eg. using "ar x") and
add them to the target archive. The ar program isn't very smart about
what it allows you to add to an archive. On some platforms, such as
AIX, you purposely add both binary and non-binary data to an archive to
produce a distributable package.
You can see an example of archive extraction and here:
http://cvs.openwbem.org/cgi-bin/viewcvs.cgi/openwbem/ow_ar.sh?rev=1.5&content-type=text/vnd.viewcvs-markup
This ow_ar.sh script acts as a wrapper around ar, which expects the path
to the ar program and any "unusual" parameters as the first arguments
followed by a '--'. It will extract the objects from each source
archive provided thereafter, rename them so they don't collide with each other, and create the target archive.
Example usage (to clarify my horrible description):
ow_ar.sh /usr/bin/ar -- cru TARGET.a source1.o source2.o SOURCE3.a ...
This will create TARGET.a with the object files from SOURCE3.a and all
of the other objects specified on the command line, while avoiding
object file name collision.
I hope that helps.
-Kevin-
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden