LinuxCommandLibrary

gcc-ranlib-4.8

Create or update archive index (gcc-4.8)

SYNOPSIS

gcc-ranlib-4.8 [-v|-t|-D|-u] archive

PARAMETERS

-D, --delete
    remove the symbol index from the archive

-t, --table
    update/create the table of contents/index

-u, --update
    force index update even if valid

-v, --verbose
    print verbose output during operation

--target=BFDNAME
    object format to use (for cross tools)

--help
    display usage summary

--version
    print version information

DESCRIPTION

gcc-ranlib-4.8 is the ranlib utility from the GCC 4.8 compiler toolchain on Linux systems like Debian or Ubuntu. It generates or updates a symbol index for static archive libraries (typically .a files), storing it as a special member (e.g., __.SYMDEF). This index enables efficient symbol lookup by linkers and other tools.

Primarily used after building a library with ar: add object files to an archive, then run gcc-ranlib-4.8 to index it. Without indexing, libraries are slower to link as every object must be scanned.

This version ensures compatibility with GCC 4.8's target architecture and multilib setups, distinguishing it from system ranlib. It's a symlink or wrapper invoking the appropriate binutils ranlib for GCC 4.8's configuration, supporting cross-compilation.

CAVEATS

Version-specific to GCC 4.8; mismatches with other GCC/binutils may cause errors. Not needed for shared libraries (.so). Archive must be writable.

EXAMPLE

ar rcs libexample.a foo.o bar.o
gcc-ranlib-4.8 libexample.a

Creates/updates index for libexample.a.

MULTI-TARGET

In multilib: gcc-ranlib-4.8 --target=x86_64-linux-gnu lib.a for 64-bit index.

HISTORY

Part of GCC 4.8 released May 2013. GCC toolchains provide versioned binutils wrappers like gcc-ranlib since GCC 4.x to support multilib/cross-compiling without system tool conflicts.

SEE ALSO

ar(1), ranlib(1), gcc-ar-4.8(1), nm(1)

Copied to clipboard