what is ranlib?

This description looks pretty clear: http://sourceware.org/binutils/docs/binutils/ranlib.html

So if you archive a collection of object files, say:

$ ar r fruits.a apple.o orange.o pineapple.o

Then running

$ ranlib fruits.a

creates an index of the contents of fruits.a and stores the index in fruits.a. This is useful for linking and in case the objects call each other.


ranlib adds or updates object files in a static library. Linkers can use static libraries when linking in order to provide symbols that the code needs in order to operate (as opposed to the loader looking for them in dynamic libraries when running the executable).


ranlib generates an index to the contents of an archive and stores it in the archive. The index lists each symbol defined by a member of an archive that is a relocatable object file. An archive with such an index speeds up linking to the library and allows routines in the library to call each other without regard to their placement in the archive.

source: ranlib man page

Tags:

Linux

Macos