My question is similar to how to install gcc 4.9.2 on RHEL 7.4
But I'm trying to get C++14 support on Red Hat 7 so I can install mapnik.
I've tried:
# yum-config-manager --enable rhel-server-rhscl-7-rpms
Install gcc, g++ version 4.9.2 :
# yum install devtoolset-3-gcc-c++
Enabling gcc-4.9, g++-4.9 : $ scl enable devtoolset-3 bash
But I keep getting
C++ compiler does not support C++14 standard (-std=c++14), which is required. Please upgrade your compiler
The issue is that devtoolset-3 contains the c++11 standard. Making and installing GCC from source caused two GCC versions to exist together. The default being the c++11 version. In order to get the correct version of gcc I needed to install devtoolset-7 and make sure devtoolset-3 was superseded or removed.
Here is how I enabled it:
1. Install a package with repository for your system:
On RHEL, enable RHSCL repository for your 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
You can download GCC sources and build it.
Generally the process involve:
Download tar.gz with GCC source code, from here: https://ftp.gnu.org/gnu/gcc/
Configure, Make and install. You can look for documentation in their site on how to do it, specifically you can start here:
https://gcc.gnu.org/wiki/InstallingGCC
Related
I'm struggling compiling an old GCC version on Centos 8.
Basic development tools come with GCC 8.5, but I would need to get GCC 5.3.
I've tried the following:
yum install glibc.i686 ncurses-libs.i686
wget http://ftp.gnu.org/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.gz
tar -xvf gcc-5.3.0.tar.gz
cd gcc-5.3.0/
./contrib/download_prerequisites
./configure --prefix=/usr/local/gcc/5.3.0 --disable-multilib
make
sudo make install
But I always end-up with error at make stage. Also made a try with https://github.com/BobSteagall/gcc-builder, but no more success.
Final use case is to be able to compile GDAL on Centos 8 with MrSID driver, however MrSID is compiled with GCC 5.3, and I get errors at GDAL compilation with GCC 8.5
In order to use the C++17 include <filesystem> I need gcc-9 package in my centos docker.
By default centos:latest (aka 8) will install gcc 8.3.1 from the regular distro repo.
Is there any PPA, testing repo, whatever, where I can easily install a gcc-9 (or later) package (i.e. not build it from source)
Thanks !
note: need gcc-9 to have good C++17 <filesystem> support.
GCC 9 Release note:
Using the types and functions in <filesystem> does not require linking with -lstdc++fs now.
src: https://gcc.gnu.org/gcc-9/changes.html
note2: CMake 3.16* doesn't support any cxx_filesystem compiler feature AFAIK.
ref: https://cmake.org/cmake/help/latest/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
note3: you can found log here: https://github.com/Mizux/KalistoUnpacker/runs/642516660?check_suite_focus=true
Simply use dnf
dnf -y install gcc-toolset-9-gcc gcc-toolset-9-gcc-c++
source /opt/rh/gcc-toolset-9/enable
ref: https://centos.pkgs.org/8/centos-appstream-x86_64/gcc-toolset-9-gcc-9.1.1-2.4.el8.x86_64.rpm.html
Note: source won't work inside a Dockerfile so prefer to use:
ENV PATH=/opt/rh/gcc-toolset-9/root/usr/bin:$PATH
or better
RUN dnf -y install gcc-toolset-9-gcc gcc-toolset-9-gcc-c++
RUN echo "source /opt/rh/gcc-toolset-9/enable" >> /etc/bashrc
SHELL ["/bin/bash", "--login", "-c"]
RUN gcc --version
this command work for me
dnf install gcc --best --allowerasing
I have built a C++ app on a VM Ubuntu 16.04 on which I have installed g++ compiler 6.2.0 in order to support C++14 features. When I tried to run it on new clean VM 16.04 which has default the g++ 5.4.0 the error /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found pops up.
I've noticed that on the VM with the updated compiler library libstdc++.so.6.0.22 has been installed. On the clean VM I'd like to avoid to update the compiler so I tried to install only the latest libstdc++6 package. However the library that was installed was libstdc++.so.6.0.21 and so the problem persisted. How can I install specifically the libstdc++.so.6.0.22 version?
You need to upgrade libstdc++6 to latest version like this
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6
After that you can check if you get GLIBCXX desired version like this:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
You could try to use pinning to make sure only the packages you want are updated to a newer version.
Alternatively, you could simply compile your program with g++ 5.4, because according to this page, this compiler already supports all c++14, the only difference is that g++-6 defaults to -std=c++14, whereas with g++-5 you have to set the language standard explicitly.
How to install gcc version 4.8 on centos or scientific linux operating systems which require yum for installing.
I tried to download gcc from https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/ and then ran ./configure and then make. After running make it gives me the error: configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Is there some way by which I may install gcc version 4.8 on linux using yum install
I tried:
1). I tried with yum --enablerepo=testing-2-devtools-6 install devtoolset-2-gcc devtoolset-2-gcc-c++ it gives me repository not found
2). yum group install "Development Tools". It gives me Package gcc-4.4.7-11.el6.x86_64 already installed and latest version
3). building it from scratch, you'll have to do ./contrib/download_prerequisites first to get MPFR, GMP and MPC in the GCC source tree, then make a separate directory and run /path/to/gcc/source/configure.
It gives:
configure: error: building out of tree but /home/Softwares/gcc-4.8.2
contains host-x86_64-unknown-linux-gnu
https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/3/html/3.0_Release_Notes/DTS3.0_Release.html#Features
Install the Red Hat Developer Toolset 3.0 (or 2.X) in a way similar to what is described here. (Basically you use a repo someone else built for CentOS).
Google says to try
yum group install "Development Tools"
check out: http://www.cyberciti.biz/faq/centos-rhel-7-redhat-linux-install-gcc-compiler-development-tools/
Due to legacy issues I have to install the gcc/g++ version 4.4.7 in my current Ubuntu-gnome 14.04 32 bit virtual machine.
The default update via apt-get install is the 4.8.2 which is a "no go" work for this project.
I've removed it (apt-get remove) . The downloaded and tried to install the 4.4.7 source but it requires to many dependencies.
Via apt-get install I've tried doing:
sudo apt-get install gcc-4.4
The download/install is quite fast and when checkign gcc version it give indication that no gcc is installed to run the
sudo apt-get install gcc
If I do this I'll get the 4.8version.
All above also applies to g++.
I compiled the code with the following flag which solved the problem:
g++-4.4.7
It compiles for a specific version. (in this case 4.4.7)
To install a specific version use sudo apt-get install package=version. Or use synaptic package manager which allows you to install specific versions.