What is linux gcc version

How to Check the Version of my gcc?

Above is the first error in my build log. I didn’t try to compile glibc/gcc myself, and I installed them via yum. One fishy thing I found is:

$ ll /usr/include/c++/ total 4 drwxr-xr-x. 12 root root 4096 Dec 17 14:16 4.8.2 lrwxrwxrwx 1 root root 5 Dec 17 14:16 4.8.5 -> 4.8.2 $ 
$ yum info gcc-c++ Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.uhost.hk * epel: mirrors.hustunique.com * extras: centos.uhost.hk * updates: centos.uhost.hk Installed Packages Name : gcc-c++ Arch : x86_64 Version : 4.8.5 Release : 4.el7 Size : 16 M Repo : installed From repo : base Summary : C++ support for GCC URL : http://gcc.gnu.org License : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD Description : This package adds C++ support to the GNU Compiler Collection. : It includes support for most of the current C++ specification, : including templates and exception handling. 

Any idea how to verify the headers in /usr/include/c++/4.8.2 is indeed from 4.8.5 package? Thanks in advance. P.S. I think probably glibc is irrelevant but here is the info:

$ ldd --version ldd (GNU libc) 2.17 Copyright (C) 2012 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. Written by Roland McGrath and Ulrich Drepper. 

Источник

Check C++ Compiler Version in Linux

Check C++ Compiler Version in Linux

This article is about checking the version of the C++ compiler installed on your Linux operating System. Moreover, we will also explore the activation process of C++ 11, the latest version of C++, while writing this article.

Check C++ Compiler Version in Linux

What is GCC compiler? The GCC is an acronym for GNU Compiler Collection. It is a compiler that can compile mainly C and C++ codes but can also be used for Objective C and Objective C++.

GCC provides two different commands for the compilation of C and C++ codes. The gcc command is for the compilation of C programs, and the g++ command is for the compilation of C++ programs.

There are different versions of the compilers installed on your system. We can find out the version of the compiler using the following command:

It will give the version details of the GCC compiler installed on your system.

check cpp compiler version in linux - image one

If you are using a g++ compiler, then you will use the following command:

Читайте также:  Linux merge files to one

It will give the details of the g++ compiler version installed on your system.

check cpp compiler version in linux - image two

However, if you are using C++ 11, the latest version of C++ language, you need to activate that in the g++ compiler. C++ 11 is not the version of the compiler but the version of C++ standard; therefore, to fully use its features, you need to activate it using the following command:

It is illustrated in the following image:

check cpp compiler version in linux - image three

It will compile the program by activating the C++ 11 features first.

Related Article — C++ Version

Источник

How to Know the GCC Version Used to Compile Linux kernel on Linux

If you want to get the running Linux kernel version on your system, you can use the following command to get it.

devops@devops-osetc:~$ uname -a Linux devops-osetc 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux devops@devops-osetc:~$ cat /proc/version Linux version 4.8.0-36-generic (buildd@lgw01-18) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017

From the above outputs, you can know the current version of running Linux kernel is 4.8.0-36.

Check GCC Compiler Version Used to Compile Kernel

If you installed multiple versions of GCC compilers in your system, and then you want to check the GCC compiler version that used to compile the running Linux kernel on your system, How to achieve the result. You can get it from /proc/version file. type the following command:

Linux version 4.8.0-36-generic (buildd@lgw01-18) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017

So we can see from the above outputs that the gcc version is gcc version 5.4.0 .

Install An Older GCC Compiler Version (gcc 4.3.2)

If you need to install an older version of GCC Compiler on your Linux system, you can download the GCC Compiler source package from http://mirrors-usa.go-parts.com/gcc/releases/gcc-4.3.2/gcc-4.3.2.tar.gz, and compile and install the source code. just do the following commands:

$ wget http://mirrors-usa.go-parts.com/gcc/releases/gcc-4.3.2/gcc-4.3.2.tar.gz $ tar -zxvf gcc-4.3.2.tar.gz $ cd gcc-4.3.2 $ ./configure $ make;make install;

Check the Version of GCC Compiler Is Installed

If you want to check the versions of GCC compiler are installed in your Linux system, you can use the following commands:

For Ubuntu/Debian Linux:

devops@devops-osetc:~$ dpkg --list | grep -i gcc ii gcc 4:5.3.1-1ubuntu1 amd64 GNU C compiler ii gcc-3.4 3.4.6-5 amd64 The GNU C compiler ii gcc-3.4-base 3.4.6-5 amd64 The GNU Compiler Collection (base package) ii gcc-5 5.4.0-6ubuntu1~16.04.4 amd64 GNU C compiler ii gcc-5-base:amd64 5.4.0-6ubuntu1~16.04.4 amd64 GCC, the GNU Compiler Collection (base package) ii gcc-6-base:amd64 6.0.1-0ubuntu1 amd64 GCC, the GNU Compiler Collection (base package) ii gir1.2-packagekitglib-1.0 0.8.17-4ubuntu6~gcc5.4ubuntu1.1 amd64 GObject introspection data for the PackageKit GLib library ii libcaca0:amd64 0.99.beta19-2build2~gcc5.2 amd64 colour ASCII art library ii libcc1-0:amd64 5.4.0-6ubuntu1~16.04.4 amd64 GCC cc1 plugin for GDB ii libgcc-5-dev:amd64 5.4.0-6ubuntu1~16.04.4 amd64 GCC support library (development files) ii libgcc1:amd64 1:6.0.1-0ubuntu1 amd64 GCC support library ii libgomp1:amd64 5.4.0-6ubuntu1~16.04.4 amd64 GCC OpenMP (GOMP) support library ii libpackagekit-glib2-16:amd64 0.8.17-4ubuntu6~gcc5.4ubuntu1.1 amd64 Library for accessing PackageKit using GLib ii libquadmath0:amd64 5.4.0-6ubuntu1~16.04.4 amd64 GCC Quad-Precision Math Library ii libunity-action-qt1:amd64 1.1.0+14.04.20140304-0ubuntu2~gcc5.1 amd64 Unity Action Qt API ii libwebrtc-audio-processing-0:amd64 0.1-3ubuntu1~gcc5.1 amd64 AudioProcessing module from the WebRTC project. ii qtchooser 52-gae5eeef-2build1~gcc5.2 amd64 Wrapper to select between Qt development binary versions ii qtdeclarative5-unity-action-plugin:amd64 1.1.0+14.04.20140304-0ubuntu2~gcc5.1 amd64 Unity Action QML Components

For CentOS/RHEL Linux:

$ yum list intalled | grep -i gcc
[root@osetc_test ~]# yum list installed | grep -i 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

Choose the Default GCC Version

If you want to compile a C program with a specific version of GCC Compiler, then you need to change the default GCC compiler version, for example, you want to choose the GCC compiler 3.4 as the default compiler. just run one of the following command:

$ sudo rm /usr/bin/gcc $ sudo ln -s /usr/bin/gcc-3.4 /usr/bin/gcc

Verify the default GCC Compiler Version

devops@devops-osetc:~$ gcc --version gcc (GCC) 3.4.6 (Debian 3.4.6-5) Copyright (C) 2006 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.

Video: Check GCC Version Used to Compile running Linux kernel

Читайте также:  Uefi linux windows boot manager

See Also:

Источник

How to Check GCC Version on Ubuntu

When working with C and C++ programming languages, it is essential to use a compatible compiler that supports the desired language features and optimizes the code accordingly. GCC, the GNU Compiler Collection, is a popular choice for compiling C, C++, Objective-C, Fortran, Ada, and other languages. It is crucial to know the version of GCC installed on your Ubuntu system to ensure that it supports the code you are working with, especially when dealing with recent language features or libraries.

In this guide, we will walk you through the process of checking the GCC version on an Ubuntu system. By following these steps, you will be able to determine if your system has the appropriate version of GCC installed and if an upgrade or downgrade is necessary to meet your development needs.

Open the Terminal

To begin, open the terminal application on your Ubuntu system. You can either search for “Terminal” in the applications menu or press Ctrl + Alt + T to open a new terminal window.

Option 1: “gcc –version”

Once the terminal is open, enter the following command to check the installed GCC version:

This command will display the current GCC version installed on your system, along with additional information about the compiler.

ehowstuff@ubuntu14:~$ gcc --version gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 Copyright (C) 2013 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.

Option 2: “gcc -v”

Alternatively, you can type “gcc -v” command:

ehowstuff@ubuntu14:~$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

The “gcc -v” command provides more detailed information about your GCC installation compared to “gcc –version”. When you execute this command, it displays information about the compiler’s configuration, including the target system, supported languages, and the options used during the compilation process. This information can be helpful if you need to know the specifics of your GCC installation, such as the target architecture or enabled features.

Читайте также:  Linux unable to load shared library

Option 3: “aptitude show gcc”

Another alternative is to execute “aptitude show gcc” command:

ehowstuff@ubuntu14:~$ aptitude show gcc Package: gcc State: installed Automatically installed: yes Version: 4:4.8.2-1ubuntu6 Priority: optional Section: devel Maintainer: Ubuntu Developers Architecture: amd64 Uncompressed Size: 42.0 k Depends: cpp (>= 4:4.8.2-1ubuntu6), gcc-4.8 (>= 4.8.2-5~) Recommends: libc6-dev | libc-dev Suggests: gcc-multilib, make, manpages-dev, autoconf, automake1.9, libtool, flex, bison, gdb, gcc-doc Conflicts: gcc-doc (< 1:2.95.3), gcc-doc (< 1:2.95.3), gcc Provides: c-compiler Description: GNU C compiler This is the GNU C compiler, a fairly portable optimizing compiler for C. This is a dependency package providing the default GNU C compiler.

The "aptitude show gcc" command gives you information about the GCC package from the package manager's perspective. Aptitude is a package manager used in Debian and Ubuntu systems, and the command provides details such as the package version, dependencies, a description of the package, and its file size. This information can be useful when managing software packages on your system, especially when dealing with dependencies or determining which version of GCC is available through the package manager.

Commands and Functions:

  • gcc - The GNU Compiler Collection command
  • --version - An option that displays the version information of the installed GCC
  • gcc -v - This command displays verbose information about the installed GCC version, including the configuration options used during the compilation process, supported languages, and the target architecture.
  • aptitude show gcc - This command provides detailed package information for the installed GCC compiler, including package version, dependencies, description, and file size. Aptitude is a package manager for Debian and Ubuntu systems that simplifies the management of software packages.

Conclusion

By following these steps, you have successfully checked the GCC version on your Ubuntu system. With this information, you can now determine whether your current GCC installation meets the requirements for your development projects. If necessary, you can upgrade or downgrade your GCC installation to a version that supports the desired language features and optimizations.

We hope this guide has been helpful in learning how to check the GCC version on your Ubuntu system. If you have any suggestions or improvements, please feel free to leave a comment below.

Источник

Оцените статью
Adblock
detector