RANLIB(1)

✨ RANLIB(1) ✨

okay bestie, welcome to the GNU Development Tools corner of the group chat πŸ’… this is the manual for ranlib, and yes it's short and yes it's iconic.


🌸 NAME 🌸

ranlib β€” generate an index to an archive πŸ—‚οΈβœ¨


πŸŽ€ SYNOPSIS πŸŽ€

ranlib [--plugin name] [-DhHvVt] archive

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does ranlib actually do? it generates an index to the contents of an archive, and then it stores that index in the archive. that's it, that's the job. 🫢

and what's in that index? it lists every single symbol that's defined by a member of the archive β€” but only the members that are relocatable object files. iykyk. 🌈

want to peek at the index yourself? you can use nm -s or nm --print-armap to list it. no cap. πŸ‘€

and why do we care? because an archive with an index like this speeds up linking to the library. main character behavior fr fr. πŸ”₯

also, plot twist: the GNU ranlib program is literally another form of GNU ar. running ranlib is completely equivalent to executing ar -s. same thing, different outfit. πŸ’…


πŸ’– OPTIONS πŸ’–

  • -h, -H, --help β€” show usage information for ranlib. helpful king behavior. πŸ‘‘
  • -v, -V, --version β€” show the version number of ranlib. 🏷️
  • -D β€” operate in deterministic mode. the symbol map archive member's header will show zero for the UID, GID, and timestamp. when you use this option, multiple runs will produce identical output files. so reproducible, so slay. ✨

if binutils was configured with --enable-deterministic-archives, then this mode is on by default. and you can turn it off with the -U option, described below. πŸ‘‡

  • -t β€” update the timestamp of the symbol map of an archive. ⏰
  • -U β€” do not operate in deterministic mode. this is literally the inverse of the -D option above: the archive index will get actual UID, GID, timestamp, and file mode values. real ones, not zeros. 🫑

if binutils was configured without --enable-deterministic-archives, then this mode is on by default.

  • *@file* β€” read command-line options from file. the options read get inserted in place of the original @file option. and if file doesn't exist, or can't be read? then the option is treated literally and not removed. it's giving "we tried, moving on." 😭

options inside file are separated by whitespace. a whitespace character can be included in an option by surrounding the entire option in either single or double quotes. and any character (including a backslash) can be included by prefixing that character with a backslash. sneaky but valid. πŸ™ˆ

and bestie, the plot thickens: the file may itself contain additional @file options, and any such options will be processed recursively. it's files all the way down. πŸŒ€


πŸ’œ SEE ALSO πŸ’œ

ar(1), nm(1), and the Info entries for binutils. go read those too, they're the supporting cast. 🎬


Copyright (c) 1991-2026 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". πŸ“œ


okay that's the whole page, nothing skipped, nothing invented. every flag got its moment. πŸ’–

and that's a wrap on the ranlib manual, bestie πŸŽ€ this edition is from binutils-2.47, dated 2026-09-12 β€” so when you cite it, cite it with your whole chest. mwah. πŸ˜˜πŸ’…

πŸ“¦ where this page comes from