{{ :supportukraine.gif|}}
====== Compiler: Installing multiple GCC compilers on a CentOS 7 system with Tux ======
{{en:tux.png |Hey, my name is "Tux"!}} **Did you ever wonder how you can install multiple GCC compilers on your Linux system?**
\\ \\
Hey, my name is "Tux" and this tutorial will show you how you can get multiple GCC compilers on a single Linux system in case you need it running in parallel.
----
\\
===== Start of tutorial =====
Installing required tools and a //GCC// compiler from default repository:
$ yum install git make gmp-devel mpfr-devel libmpc-devel
$ yum groupinstall "Development Tools"
Now navigate to the following directory:
$ cd /tmp
Download the desired //GCC// release:
\\ Note: Replace the following placeholders '''' with the release number according to the desired //GCC// release:
$ curl https://ftp.gnu.org/gnu/gcc/gcc-../gcc-...tar.gz -O
Now decompress the downloaded package:
$ tar -zxvf gcc-...tar.gz
Now create a temporary build directory:
$ mkdir gcc-..-build
Navigate into that build directory:
$ cd gcc-..-build
Execute //Makefile// configuration:
$ ../gcc-../configure --enable-languages=c,c++ --disable-multilib --prefix=/usr/local/gcc-..
Start compiling:
$ make -j$(nproc) && make install
Now the installation should be done.
\\ By going the described way it is possible to install multiple //GCC// compilers in parallel.
\\ Now when it is required to set a specific compiler version for //CMAKE// there are two settings required to be set each time:
\\ Beware: The following two settings are only applied temporary for the current session by the operating system. If it is required to set a specific default //GCC// version have a look on the info box //Optional// further down.
- Attaching the path of the desired //GCC// compiler version's executables in global path settings: \\ $ export PATH=/usr/local/gcc-../bin:$PATH
- Attaching the path of the desired //GCC// compiler version's //Shared Libraries// in global library path settings: \\ $ export LD_LIBRARY_PATH=/usr/local/gcc-../lib64:$LD_LIBRARY_PATH
Check whether the desired //GCC// version is being used by system now:
$ gcc --version
If it is required to set a specific default //GCC// compiler version for the operating system global path variables and global library path variables have to be set inside the following file:
\\
\\
$ vi /etc/profile
Add the following content:
export PATH=/usr/local/gcc-../bin:$PATH
export LD_LIBRARY_PATH=/usr/local/gcc-../lib64:$LD_LIBRARY_PATH
Save the file and quit the editor.
\\
\\ Now reboot the system:
$ reboot -h now
Check whether the desired default //GCC// version is being used by system now:
$ gcc --version
\\
===== End of tutorial =====
\\
\\
Appreciate my work? \\ [[https://www.buymeacoffee.com/fabioU|Buy me a coffee]] {{:buymeacoffee.png|}} or [[https://www.paypal.com/donate/?hosted_button_id=TH8Q3NTJCAJBA|PayPal]] {{:paypal.png|}}
\\
\\
{{htmlmetatags>metatag-robots=()}}