Re: [dev] Replace ranlib(1) calls?

From: Roberto E. Vargas Caballero <>
Date: Fri, 22 Jul 2022 17:26:52 +0200


On Wed, Jul 20, 2022 at 12:23:01PM +0000, Tom Schwindl wrote:
> ranlib(1) is, in fact, legacy. It was used to create symbol tables for archives
> before ar(1) was able to do that by itself.
> POSIX now specifies that ar(1) should create a symbol table by default, when
> there is at least one recognized object file[1]. Additionally, the `s` option exists
> which does exactly the same as ranlib(1)[2].

Well, I disagree about ranlib to be obsolete. Ar is guaranteed to add an
index in COFF and ELF systems, but not in a.out. I also know that 99.99%
of the people will ignore such systems, but I personally care about them.
Also, using ranlib doesn't harm so I personally don't see the advantage
of removing it.

> ar rcs files...
> which not only makes the creation of static libraries more portable,
> but also simpler.

More portable? It is just the opposite, if you use ranlib you can support
systems where ar doesn't create an index in the archive (for example if
you use scc ar :P).

Received on Fri Jul 22 2022 - 17:26:52 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 22 2022 - 18:00:09 CEST