What Library Does Ld Option -lrt Refer To (bionic Libc)?
What does this option to ld mean? -lrt I know to some degree it means that ld is looking for the library with real-time extensions, but after searching extensively, I couldn't find
Solution 1:
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 inthis 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 forthis
library.
Solution 2:
-l
is the flag used to link a library into your final executable. In this case, the library in question is librt.a
(or librt.so
or librt.dylib
, depending on your system). librt
is the realtime extensions library.
Post a Comment for "What Library Does Ld Option -lrt Refer To (bionic Libc)?"