Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC -lm -lz -lrt options - what are they about?

Tags:

I know, that these are some common/basic libraries, but what do they mean exactly?

For example, I know, that -lm is some math library, but is this the standard math library or what?

-lz for compression? What compression?

And I don't have any idea what is this one - -lrt.


Can someone specify these things:

  • math library - the same that we use when we include <cmath> or <math.h>?
  • compress library - what does this mean - provides some tools, that we can use to compress files, or helps the compiler/linker to do some compress-things?
like image 348
Kiril Kirov Avatar asked Apr 14 '11 12:04

Kiril Kirov


People also ask

What are GCC options?

When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.

What does a GCC do?

It functions as a cross compiler, creating executable code for a platform other than the one on which the compiler is running. GCC is also a core component of the tightly integrated GNU toolchain, produced by the GNU Project, that includes glibc, Binutils, and the GNU Debugger (GDB).

What is the GCC in simple terms?

Gulf Cooperation Council (GCC), political and economic alliance of six Middle Eastern countries—Saudi Arabia, Kuwait, the United Arab Emirates, Qatar, Bahrain, and Oman.

What is the use of options in compiler?

The / compiler option is used to turn on directives and specify constants. By adding this compile switch, you turn on the directive (or off, if the directive is preceded by NO).


1 Answers

  • -lz - is zlib, http://zlib.net/
  • -lm - is the math library as you've worked out (implementation defined AFAIK)
  • -lrt- provides POSIX realtime extensions: http://www.s-gms.ms.edus.si/cgi-bin/man-cgi?librt+3LIB
like image 54
Nim Avatar answered Dec 05 '22 11:12

Nim