简体   繁体   中英

What's the relationship between binutils and gcc?

As titled, is binutils contained in gcc for Centos Linux? If I install gcc rpm package, is there need to install binutils also? What's more, are gcc and g++ both installed by default in Centos?

The gcc package probably contains the compiler proper, eg files /usr/bin/gcc and directory /usr/lib/gcc/x86_64-linux-gnu/4.8/ (which contains the cc1 executable).

The /usr/bin/gcc program starts cc1 (or cc1plus etc...) to compile your source code *.c , and also as to translate cc1 -generated assembly code (produced by cc1 ) into object file *.o , and at last ld to link.

Compile once with gcc -v to understand what is happening, it would show the really executed binaries. Notice that gcc is only a driving program (starting other executables like cc1 , as , ld ...)

The as and ld programs are provided by binutils -which is needed to compile.

So the binutils package is a required dependency for the gcc package (with many other dependencies, probably including libc and libc-devel , but if you really want you could use some other libc like MUSL libc ; the libc is generally providing the dynamic linker like /lib/ld-linux.so* ).

Learn how to use rpm (on Centos, or dpkg on Ubuntu & Debian) to query the dependencies between packages .

For development you probably want some other packages. Debian has the build-essential virtual package. Probably CentOS has an equivalent. And you'll surely want to use some libraries (and you want the development packages for them, eg on Debian libcurl4-gnutls-dev to develop with the libcurl HTTP client library). See also this answer (for Ubuntu and Debian, but you can adapt it for CentOS).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM