Question

When using ar with an archive name that already exists, this message is generated:

+ ar rcs /tmp/libcpfs.a.3nbsv /tmp/cpfs.c.ERGsn /tmp/log.c.1lk6G
ar: /tmp/libcpfs.a.3nbsv: File format not recognized

The existing archive name is either an empty file (created by mktemp).

I want to clobber whatever contents are there anyway, the contents of any existing file (be it an ar or not) don't interest me. How can I enforce this?

Update0

I'm currently using rm "$libcpfs_a" && ar rcs "${libcpfs_a}" ${libcpfs_objs[*]} as a workaround.

Was it helpful?

Solution

Try forcibly removing the file before calling ar.

rm -f $file
ar rcs $file foo.c bar.c
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top