[comp.binaries.ibm.pc.d] HELP, ar on dj's gcc release is not working for me

bjones@magnus.acs.ohio-state.edu (William A Jones) (04/25/91)

When I attempt to create an archive file, I am typing

	ar -r libxxx.a file1 file2 ... fileN

and I am getting the message that the archive has been created.  Then
when I try to do anything else with the archive file, such as try to add
an additional file, print a table of contents, or access it in any way, I
get the message

	file1.o
	ar: file libxxx.a not a valid archive

Does anyone have any suggestions about what I am doing wrong or forgetting to
do??  I'm beginning to get desparate since the program I am debugging uses
(at last count) 24 modules which have already been debugged and I am tired
of wading through the command line link and of writing makefiles for it.

Thanks in advance

--Bill

bjones@magnus,ircc.ohio-state.edu
bjones@geo1s.mps.ohio-state.edu

dj@ctron.com (DJ Delorie) (04/25/91)

In article <1991Apr25.151211.6777@magnus.acs.ohio-state.edu>, bjones@magnus.acs.ohio-state.edu (William A Jones) writes:
> When I attempt to create an archive file, I am typing
> 
> 	ar -r libxxx.a file1 file2 ... fileN
> 
> and I am getting the message that the archive has been created.  Then
> when I try to do anything else with the archive file, such as try to add
> an additional file, print a table of contents, or access it in any way, I
> get the message
> 
> 	file1.o
> 	ar: file libxxx.a not a valid archive
> 
> Does anyone have any suggestions about what I am doing wrong or forgetting to
> do??  I'm beginning to get desparate since the program I am debugging uses
> (at last count) 24 modules which have already been debugged and I am tired
> of wading through the command line link and of writing makefiles for it.

There appears to be a bug (?) in ar whereby once an archive is
sequenced, you can't do anything with it (except link with it), but
you have to sequence the archive to link against it.  The method I
suggested in the documentation (at least I think I documented it) is:


stuff.a : $(OBJS)
	ar r stuff1.a $(OBJS)
	copy stuff1.a stuff.a
	ar rs libstuff.a


Others claim that there is no such bug, by the above method is the one
I use to create the libraries I distribute, because *I* always get
that bug.


DJ
dj@ctron.com