What library does ld option -lrt refer to (Bionic libc)?

When you see a -lsomething, the library name is libsomething. Doing a man librt says the following:

NAME
     librt, libposix4 - POSIX.1b Realtime Extensions library

SYNOPSIS
     cc [ flag... ] file... -lrt [ library... ]

DESCRIPTION
     Functions in this library provide  most  of  the  interfaces
     specified  by  the  POSIX.1b  Realtime Extension.  See stan-
     dards(5). Specifically, this includes the interfaces defined
     under   the   Asynchronous  I/O,  Message  Passing,  Process
     Scheduling, Realtime Signals Extension,  Semaphores,  Shared
     Memory  Objects,  Synchronized  I/O, and Timers options. The
     interfaces defined under the Memory  Mapped  Files,  Process
     Memory  Locking,  and  Range Memory Locking options are pro-
     vided in libc(3LIB)

     See the man pages for the individual interfaces  in  section
     3RT for information on required headers.

     The name libposix4 is maintained for backward  compatibility
     and  should be avoided. librt is the preferred name for this
     library.

Leave a Comment