I’m trying to understand why libtool runs ranlib when installing a static library. This is an example from the link: https://www.gnu.org/software/libtool/manual/html_node/Installing-libraries.html
$ libtool --mode=install cp libhello.la /usr/local/lib/libhello.la cp libhello.la /usr/local/lib/libhello.la cp .libs/libhello.a /usr/local/lib/libhello.a ranlib /usr/local/lib/libhello.a
But, isn’t the index table already created and shouldn’t it be just a simple copy operation? I found running ranlib at the end of the copy redundant as the library already has an index.
Thanks.
Advertisement
Answer
Back in the bad old days, ar
did not create an index.
libtool
is intended to run on a variety of systems, some of which have an index-creating ar
and some don’t.
For compatibility’s sake, it still invokes ranlib to create the index after installing the static library.