Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Using a higher version of GCC in an RPM based distro  (Read 1912 times)

0 Members and 1 Guest are viewing this topic.

Arun

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Using a higher version of GCC in an RPM based distro
« on: July 31, 2017, 06:09:02 pm »
GCC(GNU Compiler Collection) is a compiler system produced by the GNU Project supporting various programming languages.
It is a key component of the GNU toolchain and the standard compiler for most Unix-like Operating Systems. A majority of the Linux applications use GCC as their compiler.

Sometimes we will want to use the latest version of an application by compiling and installing it from source. Usually this requires the latest version of GCC for compiling; but the GCC version provided by operating system will be quite old. The Devtoolset(Developer Toolset) provided by Software Collections provide a solution in such instances.


We can install Devtoolset by performing the following steps.

Install yum repo file, GPG key and basic documentation for Software Collections for CentOS.
Code: [Select]
# yum install centos-release-scl
Search for all GCC packages provided by SCL.
Code: [Select]
# yum search devtoolset | grep gcc
We will see that the latest GCC packages provided by SCL are devtoolset-6-gcc.x86_64(GCC version 6) and devtoolset-6-gcc-c++.x86_64(C++ support for GCC version 6).

Let us install the required packages.
Code: [Select]
# yum install devtoolset-6-gcc.x86_64 devtoolset-6-gcc-c++.x86_64
Let us check if Devtools 6 is installed as a registered Software Collection. List all the installed Software Collections on the system.
Code: [Select]
# scl -l
devtoolset-6

Enable the Devtools 6 environment with bash instance.
Code: [Select]
# scl enable devtoolset-6 bash
We will enter into a new bash instance. Confirm that we are using a latest version of GCC.
Code: [Select]
bash-4.1# gcc --version
gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3

After performing the required operations with this version of GCC, we can exit from the Devtools environment as following.
Code: [Select]
# exit

Done  8)
Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!