What is the -lrt flag in gnu-make?

At a later stage in the gnu-make process, gmake sent a command similar to:

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

In this command, what does the -lrt value mean?

+6
source share
1 answer

This is not related to make; make will never add such a flag on its own. Anyone who wrote your makefile will add this flag to the link line itself. This is a compilation command, and -lrt is the flag passed to the compiler. The -l flag indicates that you should reference the library, and the library name follows; therefore, for -lrt this means "link to the rt library". This forces the linker to look for libraries named librt.a or librt.so (for shared libraries) and link them to the output file.

+8
source

All Articles