How to Check What Compilers Are Installed on CentOS/RHEL/Ubuntu Linux

This post will guide you how to check what compilers are install on your CentOS/RHEL/Ubuntu/Debian Linux system. How do I check if GNU GCC Compiler is installed on Linux. How do I list all available compilers that can be installed in Linux.

Check What Compilers Are Installed


Assuming that you have installed core development tools in your Linux system, and you want to check what compilers are installed, how to achieve the results in different Linux distribution system.

For Ubuntu/Debian Linux:

If you are using the Ubuntu/Debian Linux, you can use the dpkg command to check what compilers have been installed in your system. Issue the following command:

$ dpkg --list | grep compiler

Outputs:

devops@devops-osetc:~$ dpkg --list | grep compiler
ii g++ 4:5.3.1-1ubuntu1 amd64 GNU C++ compiler
ii g++-5 5.4.0-6ubuntu1~16.04.4 amd64 GNU C++ compiler
ii gcc 4:5.3.1-1ubuntu1 amd64 GNU C compiler
ii gcc-5 5.4.0-6ubuntu1~16.04.4 amd64 GNU C compiler
ii hardening-includes 2.7ubuntu2 all Makefile for enabling compiler flags for security hardening
ii libllvm3.8:amd64 1:3.8-2ubuntu4 amd64 Modular compiler and toolchain technologies, runtime library
ii libxkbcommon0:amd64 0.5.0-1ubuntu2 amd64 library interface to the XKB compiler - shared library

For the above outputs, you can know that the GNU GCC compiler has been installed. and you can use it to compile C or C++ programs on your Linux system.

For CentOS/RHEL Linux:

If you are using the Centos/RHEL Linux, and you can use the “yum install installed” command to check what compilers are installed. Issue the following command:

# yum list installed | grep gcc

or

# yum list installed | grep java

or

# yum list installed | grep automake

Outputs:

[root@osetc_test working]# yum list installed | grep -i --color compiler
[root@osetc_test working]#
[root@osetc_test working]# yum list installed | grep gcc
gcc.x86_64 4.4.7-23.el6 @base
gcc-c++.x86_64 4.4.7-23.el6 @base
gcc-gfortran.x86_64 4.4.7-23.el6 @base
libgcc.x86_64 4.4.7-23.el6 @base
[root@osetc_test working]# yum list installed | grep java
[root@osetc_test working]# yum list installed | grep automake
automake.noarch 1.11.1-4.el6 @base
[root@osetc_test working]# yum list installed | grep perl
perl.x86_64 4:5.10.1-144.el6 @base
perl-Compress-Raw-Zlib.x86_64 1:2.021-144.el6 @base
perl-Compress-Zlib.x86_64 2.021-144.el6 @base
perl-DBD-MySQL.x86_64 4.013-3.el6 @base
perl-DBI.x86_64 1.609-4.el6 @base
perl-Error.noarch 1:0.17015-4.el6 @base
perl-Git.noarch 1.7.1-9.el6_9 @base
perl-HTML-Parser.x86_64 3.64-2.el6 @base
perl-HTML-Tagset.noarch 3.20-4.el6 @base
perl-IO-Compress-Base.x86_64 2.021-144.el6 @base
perl-IO-Compress-Zlib.x86_64 2.021-144.el6 @base
perl-Module-Pluggable.x86_64 1:3.90-144.el6 @base
perl-Pod-Escapes.x86_64 1:1.04-144.el6 @base
perl-Pod-Simple.x86_64 1:3.13-144.el6 @base
perl-URI.noarch 1.40-2.el6 @base
perl-XML-Parser.x86_64 2.36-7.el6 @base
perl-libs.x86_64 4:5.10.1-144.el6 @base
perl-libwww-perl.noarch 5.833-5.el6 @base
perl-version.x86_64 3:0.77-144.el6 @base

Check C/C++ Compiler is Installed


If you want only check if C/C++ compiler is installed on Linux, you can run the following command:

$ type -a gcc

or

$ which gcc

Outputs:

[root@osetc_test working]# type -a gcc
gcc is /usr/bin/gcc
[root@osetc_test working]# which gcc
/usr/bin/gcc

Check C/C++ Compilers Version


To check the version of GNU GCC C/C++ Compiler on your Linux system, you can issue the following command:

$ gcc --version

outpus:

[root@osetc_test working]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Check which Fortran Compiler is installed


To check the version of installed fortran compiler on your Linux system, type the following command:

$ gfortran -v

outputs;

[root@osetc_test working]# gfortran -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)

Check All Available Compilers Can be Installed


If you want to check the list of available compilers can be installed in your system, you can execute the following command:

For CentOS/RHEL Linux:

Type:

$ yum search all compiler

Outputs:

[root@osetc_test working]# yum serach all compiler
Loaded plugins: fastestmirror
No such command: serach. Please use /usr/bin/yum --help
[root@osetc_test working]# yum search all compiler
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.fileplanet.com
* epel: mirror.sjc02.svwh.net
* extras: mirror.sfo12.us.leaseweb.net
* updates: mirror.sfo12.us.leaseweb.net
=========================================== Matched: compiler ===========================================
......
compat-gcc-34.x86_64 : Compatibility GNU Compiler Collection
compat-gcc-34-c++.x86_64 : C++ support for compatibility compiler
compat-gcc-34-g77.x86_64 : Fortran 77 support for compatibility compiler
cross-gcc-common.noarch : Cross-build GNU C compiler documentation and translation files
csclng.x86_64 : A compiler wrapper that runs Clang in background
cscppc.x86_64 : A compiler wrapper that runs cppcheck in background
csmatch.x86_64 : A compiler wrapper that runs smatch in background
cswrap.x86_64 : Generic compiler wrapper
dtc.x86_64 : Device Tree Compiler
ecj.x86_64 : Eclipse Compiler for Java
eclipse-photran-intel.noarch : Intel Fortran compiler support for Photran
......

For Ubuntu/Debian Linux:

Type:

$ apt-cache search Compiler | less

Outputs:

devops@devops-osetc:~$ apt-cache search Compiler | less
antlr - language tool for constructing recognizers, compilers etc
antlr-doc - language tool for constructing recognizers, compilers etc
binutils - GNU assembler, linker and binary utilities
binutils-multiarch - Binary utilities that support multi-arch targets
ca-certificates-mono - Common CA certificates (Mono keystore)
ccache - Compiler cache for fast recompilation of C/C++ code
cmake - cross-platform, open-source make system
cmake-doc - extended documentation in various formats for CMake
cpp - GNU C preprocessor (cpp)
cpp-5 - GNU C preprocessor
cpp-5-aarch64-linux-gnu - GNU C preprocessor
cpp-5-arm-linux-gnueabihf - GNU C preprocessor
cpp-5-powerpc-linux-gnu - GNU C preprocessor
cpp-5-powerpc64le-linux-gnu - GNU C preprocessor
cpp-aarch64-linux-gnu - GNU C preprocessor (cpp) for the arm64 architecture
cpp-arm-linux-gnueabihf - GNU C preprocessor (cpp) for the armhf architecture
cpp-powerpc-linux-gnu - GNU C preprocessor (cpp) for the powerpc architecture
cpp-powerpc64le-linux-gnu - GNU C preprocessor (cpp) for the ppc64el architecture
device-tree-compiler - Device Tree Compiler for Flat Device Trees
dpkg-dev - Debian package development tools
......

Install Compiler in Linux


To install compilers on your Linux system, you can use the yum command to install the specific compiler, such as: GNU GCC compiler, you can run the following command:

$ sudo yum install gcc

or

$ sudo yum groupinstall "Development Tools"

If you are using the Ubuntu or Debian Linux, you can use the following command to install GNU GCC compiler:

$ sudo apt-get update
$ sudo apt-get install build-essential

Video: Checking What Compilers are Installed on CentOS/RHEL/Ubuntu Linux

See Also:

You might also like:

Sidebar



back to top