Ocasta Eshu
Ocasta Eshu

Reputation: 851

What is the -lrt flag in gnu-make?

In a later stage of the gnu-make process gmake sent a command similar to:

gcc -static foo.so.0 bar.o bizz.o buzz.o -pthreads -lrt

In that command, what dos the -lrt mean?

Upvotes: 14

Views: 30698

Answers (1)

MadScientist
MadScientist

Reputation: 100966

That has not related to make; make will never add a flag like that on its own. Whomever wrote your makefile will have added that flag to the link line themselves. That is a compilation command, and -lrt is a flag passed to the compiler. The -l flag specifies that you should link with a library, and the name of the library follows; so for -lrt it means "link with the rt library". This causes the linker to go look for libraries named librt.a or librt.so (for shared libraries) and link them with the output file.

Upvotes: 25

Related Questions