how to install gcc 4.9.2 on RHEL 7.4 - linux

I am trying to install gcc and g++ 4.9.2 on Linux. I'm pretty new with Linux and i saw some guides of how to install, but each time I encountered with another problem. I don't have any gcc right now on my machine.
my Linux version is:
Red Hat Enterprise Linux Server release 7.4 (Maipo)
can someone help me and give me instructions from the beginning to the end how to do this properly?
thank you very much.

yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++
update-alternatives --install /usr/bin/gcc-4.9 gcc-4.9 /opt/rh/devtoolset-3/root/usr/bin/gcc 10
update-alternatives --install /usr/bin/g++-4.9 g++-4.9 /opt/rh/devtoolset-3/root/usr/bin/g++ 10

For installing the system compilers gcc, g++, the install command is # yum install gcc-c++ → Provides version 4.8.5 : /usr/bin/{ gcc, g++ }.
Other options: 1. gcc53-c++-5.3.0-1.el6.x86_64.rpm → https://drive.google.com/file/d/0B7S255p3kFXNRm9FVnZYUnhyZzg/view?usp=sharing&resourcekey=0-1N6zQa6Sbl_WycG1O9I7JA : Download and install : # cd Downloads/ && yum install ./gcc53-c++-5.3.0-1.el6.x86_64.rpm ..... Provides /usr/bin/{gcc53, g++53}.
The devtoolset´s : https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/ →
# yum-config-manager --enable rhel-server-rhscl-7-rpms
Install gcc, g++ version 4.9.2 : # yum install devtoolset-3-gcc-c++
Note : You can have as many gcc/g++ versions as you want, installed at the same time. ( The system compilers are a must.)
gcc49-c++-4.9.3-1.el6.x86_64.rpm https://drive.google.com/file/d/1Pwq1ua80dGM72i7rpDNAIIdfcR1WK-hG/view?usp=sharing → Provides /usr/bin/{gcc49, g++49}.
gcc63-c++-6.3.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1t4WrgvpEP-6_NN3qMJhz9MS3CJhHrHKc/view?usp=sharing → Provides /usr/bin/{gcc63, g++63}.
gcc45-c++-4.5.4-1.el7.x86_64.rpm https://drive.google.com/file/d/15aRg-BPhuyaEyZA9Jy-iAyC21_pwN7nD/view?usp=sharing → Provides /usr/bin/{gcc45, g++45, gfortran45}
gcc42-c++-4.2.4-1.el6.x86_64.rpm https://drive.google.com/file/d/1eYWk6Nd63xeqqAUoJldNWRuwEGO6cAyv/view?usp=sharing → Provides /usr/bin/{gcc42, g++42}
gcc73-c++-7.3.0-1.el7.x86_64.rpm
https://drive.google.com/file/d/1PgwCP5tu8D0EJbJVTqJd7Vg8dJ4l4noi/view?usp=sharing → Provides /usr/bin/{gcc73, g++73}
gcc48-c++-4.8.5-1.el6.x86_64.rpm
https://drive.google.com/file/d/1w6fW6oSflDDYZt_cOpGj3QMEmzUC8Q9L/view?usp=sharing → Provides /usr/bin/{gcc48, g++48, gfortran48}
gcc84-c++-8.4.0-1.el7.x86_64.rpm https://drive.google.com/file/d/1xgFtsiDi2uiB1B0AcOaSpxVizzET-pJf/view?usp=sharing → Provides /usr/bin/{gcc84, g++84, gfortran84}

RHEL comes with preconfigured repo, you can search for the desired packages and install them using yum package manager.
To do so, first run ( to search gcc )
$ sudo yum search gcc
which will show you a list of available packages with the matching name
============================ Name Exactly Matched: gcc =============================
gcc.x86_64 : Various compilers (C, C++, Objective-C, ...)
gcc.x86_64 : Various compilers (C, C++, Objective-C, ...)
gcc.i686 : Various compilers (C, C++, Objective-C, ...)
=========================== Name & Summary Matched: gcc ============================
gcc-c++.x86_64 : C++ support for GCC
gcc-c++.i686 : C++ support for GCC
gcc-gdb-plugin.x86_64 : GCC plugin for GDB
gcc-gdb-plugin.i686 : GCC plugin for GDB
gcc-gdb-plugin.x86_64 : GCC plugin for GDB
gcc-objc.x86_64 : Objective-C support for GCC
...
Install the package you need by running ( to install gcc-c++ )
$ sudo yum install gcc-c++
It will the packages to be installed and ask for confirmation.
Dependencies resolved.
====================================================================================
Package Architecture Version Repository Size
====================================================================================
Installing:
gcc-c++ x86_64 8.3.1-2.fc29 updates 12 M
Transaction Summary
====================================================================================
Install 1 Package
Total download size: 12 M
Installed size: 29 M
Is this ok [y/N]:
NOTE: Steps mentioned above will install latest available version of the package.
Install a particular Version of a Package
Install all development tools

For CentOS run this command
yum install gcc-c++

Related

Redhat's RHEL8 equivalent of "apk add --no-cache gcc musl-dev linux-headers"

I am trying this sample code from "https://docs.docker.com/compose/gettingstarted on Python installed on RedHat enterprise linux 7 / 8 image.
Getting error 127 on this line
RUN apk add --no-cache git gcc musl-dev linux-headers
Thanks
On Red Hat Enterprise Linux, installing the gcc package installs both the system C compiler and the C library development files, including the required UAPI kernel headers. So this command is sufficient to install a C development environment:
yum install gcc
If you need the C++ compiler, you should use this instead:
yum install gcc-c++

Error when bootstrapping CMake:Log of errors

To install charmm program I have to install CMake, however, it doesn't install CMake.
[sohyeon#theochem11 cmake-3.15.3]$ ./bootstrap
---------------------------------------------
CMake 3.15.3, Copyright 2000-2019 Kitware, Inc. and Contributors
Found GNU toolchain
C compiler on this system is: gcc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /export/home/sohyeon/cmake-3.15.3/Bootstrap.cmk/cmake_bootstrap.log
so I tried to that script
[sohyeon#theochem11 cmake-3.15.3]$ env CC=cc CXX=CC ./bootstrap
But it still occurred same error.
I searched other ways in google. I found this two ways.
$ yum -y install gcc-c++
You need to be root to perform this command.
$ yum install gcc-c++.x86_64
You need to be root to perform this command.
But it is not solve my problem.
(And I saw cmake_bootstrap.log but I don't know what is wrong.)
(Edit)
Thank you all!
OS version : Linux theochem11.hpc.org 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[sohyeon#theochem11 cmake-3.15.3]$ gcc --version
gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
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.
[sohyeon#theochem11 cmake-3.15.3]$ g++ --version
g++ (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)
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.
cmake-3.15.3 can do bootstrap with g++ versions 6.3 .. 9.2 . ... Earlier g++ versions like 4.9 or 5.3 are failing.
RHEL 6, install gcc-c++-7.3 :
# 1. Install a package with repository for your system:
# On CentOS, install package centos-release-scl available in CentOS repository:
$ sudo yum install centos-release-scl
# On RHEL, enable RHSCL repository for you system:
$ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
# 2. Install the collection:
$ sudo yum install devtoolset-7
# 3. Start using software collections:
$ scl enable devtoolset-7 bash
https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
Five packages only are installed, with 'yum install devtoolset-7-gcc-c++' :
devtoolset-7-gcc-c++-7.3.1-5.15.el6.x86_64
devtoolset-7-binutils-2.28-11.el6.x86_64
devtoolset-7-libstdc++-devel-7.3.1-5.15.el6.x86_64
devtoolset-7-runtime-7.1-4.el6.x86_64
devtoolset-7-gcc-7.3.1-5.15.el6.x86_64
Packages http://mirror.centos.org/centos/7/sclo/x86_64/rh/devtoolset-7/
Cmake :
cd cmake-3.15.3/
scl enable devtoolset-7 bash // g++ is set to "7.3"
./bootstrap
Note : The command scl enable devtoolset-7 bash is valid for the current terminal session only.
P.S. : cmake3 is available from the EPEL repo https://fedoraproject.org/wiki/EPEL → sudo yum install cmake3 . You get cmake3-3.6.1-3.el6.x86_64 . Provides /usr/bin/cmake3
Epel packages https://dl.fedoraproject.org/pub/epel/6/x86_64/Packages/
Ref. comment
Is there any other way than using yum?
The rpm command can be used to install downloaded packages : Root password is required. Examples ...
rpm -Uvh cmake3-3.6.1-3.el6.x86_64
rpm -Uvh <package>.rpm <package>.rpm <package>.rpm <package>.rpm <package>.rpm
I met the same problems,you can solve it by downloading the latest version

Simulating RISCV on RHEL5 -- Missing libmpc-devel

My goal is to simulate RISCV in VCS on RHEL 5.11.
I am following the lowRISC tagged memory tutorial, environment setup guide:
http://www.lowrisc.org/docs/tagged-memory-v0.1/setup/
The apt-get commands are substituted with yum and equivalent packages, per the GNU toolchain repo readme:
https://github.com/riscv/riscv-gnu-toolchain
sudo yum install autoconf automake libmpc-devel mpfr-devel gmp-devel gawk bison flex texinfo patchutils gcc gcc-c++
The libmpc-devel package cannot be found, and I cannot build GCC for RISCV without it.
I believe this package can be found for RHEL6, but I do not have VCS available on a RHEL6 machine.
Is there a workaround for this issue -- e.g. can I build GCC for RISCV on another machine, then do compilation and simulation on different boxes?

How to change the default compiler of Linux Mint 18.0 from version 5.3.1 to a version below 4.0?

I need to compile a special program (i.e. configuring, making, and making install processes of nest) by an old version of g++ such as 3.3 or 3.4. However, I don't have such versions in my package manager.
I downloaded g++-3.0-3.0.4-7_alpha-deb, but I don't know if it is the true version for Linux, or how can I install it and set as the default compiler. I will appreciate if any one informs me of its possible dangers to my Linux (as I read in Google).
First : You can have as many versions of gcc, g++ as you want, installed at the same time.
The default Mint 18, Ubuntu 16.04 versions are :
sudo apt install g++ g++-4.7 g++-4.8 g++-4.9
The reliable gcc, g++ version 3.4.6 : compat-gcc34-3.4.6-ubuntu1204-1_amd64.deb
https://drive.google.com/file/d/0B7S255p3kFXNRTkzQnRSNXZ6UVU/view?usp=sharing
, and compat-gcc-34-c++_3.4.6-20_amd64.deb https://drive.google.com/file/d/0B7S255p3kFXNV3J3bnVoWGNWdG8/view?usp=sharing
Please install with sudo dpkg -i compat-gcc*
Using, examples : 1) export CC=gcc34 CXX=g++34 && [other command] , like 2) export CC=gcc34 CXX=g++34 && ./configure ... and 3) make CC=gcc34 CXX=g++34

Installing g++ 5 on Amazon Linux

I'm trying to install g++ 5.x on an EC2 instance running Amazon Linux; in Amazon's central repository the latest version is 4.8.3. What configuration to can I make to allow yum to find a newer gcc-c++ package?
Late to the party, but for those like me:
sudo yum install gcc72 gcc72-c++
For Amazon Linux 2, you have to install the following
sudo yum install -y gcc-c++
It's a requirement to install some Ruby gems that need native extensions
Installing gcc5:
# Install required libraries
sudo yum install libmpc-devel mpfr-devel gmp-devel
# Gather source code
export GCC_VERSION=5.5.0
cd /tmp
curl -o "gcc-${GCC_VERSION}.tar.gz" \
https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc- ${GCC_VERSION}.tar.gz
tar xvzf "gcc-${GCC_VERSION}.tar.gz"
cd gcc-${GCC_VERSION}
# Configure and compile
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make -j 8
# Install
sudo make install
Ensure /usr/local/bin/ is in your PATH
You may advantageously install version 7.3.0 released on 25th January 18 here
You can run yum whatprovides g++ and it will output a list of different packages versions that provide the the g++ file.
example output:
...
gcc-c++-7.3.1-12.amzn2.x86_64 : C++ support for GCC
Repo : amzn2-core
Matched from:
Filename : /usr/bin/g++
gcc-c++-7.3.1-13.amzn2.x86_64 : C++ support for GCC
Repo : amzn2-core
Matched from:
Filename : /usr/bin/g++
On Amazon Linux 2 you can run sudo yum groupinstall "Development Tools" which will install many compilers and dependencies including g++
Probably like "amazon linux ami release 2016.03", when you have gcc-4.8.3 .
This OS is very close to CentOS 7.2 / RHEL 7.
Please try : # yum install centos-release-scl
If OK, you can do : # yum install devtoolset-4-gcc-c++ ... and get g++, gcc version 5.2.1 .
Enabling "5.2.1" : $ scl enable devtoolset-4 bash . Be aware that the setting is valid for the current terminal session only.
If any issues, I can supply a link to the four packages required for g++, gcc.

Resources