Reputation: 6556
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?
Upvotes: 11
Views: 6978
Reputation: 1
The gcc
package probably contains the compiler proper, e.g. 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, e.g. 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).
In 2021 you want to use GCC 10 at least, as g++ -Wall -Wextra -g
and you could decide to code your own GCC plugin (checking some coding rules in your C++ code; you also want to document your coding conventions by writing). Be aware of the rule of five.
Upvotes: 12