I am using CentOS Linux release 7.3.1611 which has gcc 4.8.5 20150623 installed. I am looking for a way to install a newer version of gcc, specially 8.1. I found the following site on how to install gcc v7 link 1 which describes how to install gcc v7 (using devtoolset-7-gcc*). I did follow the guidelines and was able to install gcc v7. Though, if I followed the same procedure, but used "devtoolset-8-gcc*" instead the return message states "No package devtoolset-8-gcc* available.".
Performed a search and found a page called "Information for build devtoolset-8-gcc-8.1.1-4.el6" link 2, but not sure how to install this. I believe I would need to download the rpm source, compile/build the source, then finally install it.
Basically, I am looking for a easy way to install gcc v8 just like using the method described on link 1.
Thanks in advance.
To install the full tools-set including gfortran on centos 7:
yum install centos-release-scl
yum install devtoolset-8
scl enable devtoolset-8 -- bash
enable the tools:
source /opt/rh/devtoolset-8/enable
you may wish to put the command above in .bash_profile
ref:
https://unix.stackexchange.com/questions/477360/centos-7-gcc-8-installation
devtoolset-8 was only released a short while ago. The linked installation instructions may be of use. However, your question pertains to CentOS, and this does not yet appear to have been made available yet. You can see some evidence of it being build for CentOS here, but it's not been updated for the final release yet.
You could ask on the SCL mailing list for an ETA, or wait until it appears in its final form. In the meantime, you could download the RPMs from koji directly.
The follows worked in centos/rhel 7.
How to install it?
# rpm -ivh http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm
# yum install devtoolset-8
Here is the rpm from http://mirror.centos.org/centos/7/extras/x86_64/Packages/ that might be needed to be updated accordingly.
How to use it?
$ scl enable devtoolset-8 bash
$ gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 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.
The flags -std=c++17 -lstdc++fs and the following line could be helpful.
#include <experimental/filesystem>
Related
For example on el7:
to develop an nvidia CUDA application you need a newer gcc than the default gcc version 4.8.x and to get the newer version you would use a software repo called "Software Collections" (SCL)
the base python3 is 3.6 and you need newer python modules and so you install python3.8 from SCL
Starting on el8, and el9: the SCL is deprecated and so there is a different method for installing and configuring newer versions of gcc and python3.
On el8/el9/newer, how do you get newer versions of software like python3, gcc, java, etc?
in a nutshell, here are some examples for how to install and configure
for python3 to get python3.9: dnf install -y python39 && alternatives --set python3 $(command -v python3.9)
for gcc to get gcc-12: dnf install gcc-toolset-12 && source scl_source enable gcc-toolset-12
for java to get java-17: dnf install java-17 && bin_java_filename=$(rpm -qa|grep java-17|xargs rpm -ql|grep "bin\/java$"|head -1) && alternatives --set java ${bin_java_filename}
tested on rocky8, rocky9
which repo has the newer software versions?
the old method using "SCL" was deprecated
the new method is to use a repo called "appstream"
here is a post written by the distro maintainers explaining the change https://developers.redhat.com/blog/2018/11/15/rhel8-introducing-appstreams
the repo is enabled by default
how to: install newer software versions?
for python3: dnf install python39
for gcc: dnf install gcc-toolset-12
how to: change the system default?
for python3: alternatives --set python3 $(command -v python3.9)
for gcc:
edit your user .bashrc or .bash_profile or create a new file under /etc/profile.d/ with the following: source scl_source enable gcc-toolset-12
i thought scl_source would go away in el8, el9 but apparently not
for more info on scl_source go to this link https://unix.stackexchange.com/a/195219/5510 or Permanently enable RHEL scl
p.s. what is the difference between alternatives and update-alternatives?
the original tool is called update-alternatives and is from Debian linux distro
in EnterpriseLinux, Redhat rewrote the tool and called it alternatives and when you install alternatives the package also installs a symlink with name update-alternatives on your env var PATH to help you find the tool
the two are similar but not the same because their source code is different
So I'm not entirely new to Linux, but still struggle with its very many quirks and oddities.
I have an installation document for a complicated piece of software that I need to install on a Debian Bullseye machine. Unfortunately that document was written for CentOS and I now have to try that on Debian.
For some reason I first have to install gcc in its latest version, download the gcc version 5.4.0 and then use the latest gcc version to compile the 5.4.0 gcc version (would be great if somebody could explain to me why on earth anybody would want to compile a tool rather than just install it).
There was a call to a config script in the downloaded gcc files, followed by a make command, which according to the CentOS way I had to call like this:
cd gcc-5.4.0/
./configure --with-system-zlib --disable-multilib --enable-languages=c,c++
make
That fails, it takes absolutely forever to finish and tells me at the end dereferencing pointer to incomplete type 'struct ucontext'. I should mention that I have my doubts about whether or not that zlib thing causes trouble, since the recommended zlib-devel is not available on Debian, I optet for something that I assumed would be equivalent on Debian, which would be zlib1g-dev, which was already pre-installed.
Is there a standard way to install gcc 5.4.0 on Debian? Of course I've tried to just install it in the specified version using sudo apt install gcc=5.4.0, which doesn't work because it seems that it is not available. I've tried to find on packages.debian.com what versions are available, but this website is such a delight that it is not possible for me to figure that out.
How would you normally install gcc in a specific version on Debian?
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
I am trying to build QT4 (porting from Redhat 5 to 7 with an upgraded gcc compiler) in RedHat 7 and I was getting an error saying X11/Xlib.h can't be found. Anyways, after doing some research most people said to install libX11-devel to get those x11 libraries. Since I am using an offline machine I can't do "apt-get" type commands and have to manually install RPMs. So, I went to my RH-7 installation DVD and got "libX11-devel-1.6.3-3.el7.x86-64" (I have 64 bit OS) and tried to install using "yum install libX11-devel-1.6.3-3.el7.x86_64" and I am getting dependencies errors. It's saying
...Requires: pkgconfig(kbproto)
...Required: pkgconfig(xcb)
...Requires: pkgconfig(xproto)
...Requires: pkgconfig(xcb) >= 1.1.92
So, here are my questions.
1) when it says "pkgconfig(kbproto)", is it saying find the "kbproto....RPM" and do a "yum install". In my dvd I only have "xorg-x11-proto-devel-7.7.13.el7.noarch.rpm". Do I have to somehow find "xorg-x11-proto......x86_64.rpm" since it's a 64 bit machine?
2) Is there a difference between "yum install" and pkgconfig "install"? Are there any other installation variants in Linux?
3)For an offline machine, Is there anyway I can get all the dependencies and install everything at once ?
4) Why is it saying "xcb" requires twice. If I just get a xcb...rpm version above 1.1.92 can I just install it once?
Before actually answering the questions, I am going to suggest to see if you can get the latest version of the packages. The packages on the installation DVD may be really out of date and contain known vulernabilities, and other bugs. Can you use yumdownloader - in an online environment - to download the latest version onto a separate DVD and use that as the installation source? See https://access.redhat.com/solutions/10154 for more information.
To answer the questions themselves:
Requires: foo can refer to a package foo or a "feature" foo. pkgconfig(kbproto) is a "feature" (or virtual requires). You can use yum/rpm to see what provides this. On my Fedora box, for example, rpm -q --provides xorg-x11-proto-devel shows that this package indeed provides pkgconfig(kbproto).
As for x86_64 vs noarch, it doesn't matter. noarch packages work everywhere. Other packages are restricted to the platform. So x86_64 only works on intel/amd x86 64-bit machines. Installing noarch should be fine in your case. If you only had a i686 package, though, that wouldn't be sufficient. You would have to find a x86_64 or noarch package.
Yes, there's a big difference between yum and pkg-config. They do completely different things. One is a system tool for installing RPM packages. The other is a tool for developers for using the right headers and compiler flags. If your concern is finding/installing RPMs, do not use pkg-config directly.
Do you have access to an online machine that can access the RHEL 7 yum repositories? On that machine, do something like this:
mkdir rhel7-packages
cd rhel7-packages
yum provides '*/X11/Xlib.h' # make a note of the package that provides this file. it's libX11-devel on Fedora here
yumdownloader --resolve libX11-devel # download libX11-devel and all dependencies not installed on the system
Then copy/install the RPMs on the machine without internet access.
It's probably printing out xcb twice because it's two different requirements. The unversioned requirement will be satisfied if you install any verison of xcb. The versioned requirement will only be satisfied if you install 1.1.92. If you install 1.1.92, it will satisified both the requirements.
1.
You have to resolve the dependency on the system where you are building your package. This means you need to have those dependencies installed, inclusing libX11-devel. To do that, download the RPMs manually from EL7 repos to local disk and run this:
$ mkdir -p /tmp/libX11_dep_rpms && cd /tmp/libX11_dep_rpms
# Download all dependencies from here. All your packages should be available here:
# http://mirror.centos.org/centos-7/7/os/x86_64/Packages/
# Then install
$ yum localinstall *.rpm
# After this you should be able to build your qt4 package, provided all dependencies are resolved. Otherwise, repeat the procedure for all dependencies
# If you can't download packages, then you need to create a FULL DVD ISO that will contain all packages.
2.
pkgconfig ensures that a requirement is coming from a particular build that provides a particular version of the library. Here are some detail.
3.
Get the Everything ISO from EL7.
4.
This has to do with the pkgconfig and library versions.
I'm trying to install a library that uses gmp and am running the ./configure on it.
So far, I've gotten past several snags, such as requiring gcc, g++, and m4 by using:
yum install gcc
yum install gcc-g++
yum install m4
Now I'm getting this error:
checking for the GMP library version 4.1.3 or above... no
configure: error: Cannot find GMP version 4.1.3 or higher.
GMP is the GNU Multi-Precision library:
see http://www.swox.com/gmp/ for more information.
When compiling the GMP library, do not forget to enable the C++ interface:
add --enable-cxx to the configuration options.
As such, I tried both installing and updating gmp using yum:
yum install gmp
yum update gmp
Install tells me it's already installed and is v. 5.1.2
Updating says there's nothing to update.
I went to the gmp site and it is currently v. 6.0.0
I downloaded it and ran configure (using --enable-cxx), make, and make install.
Yet, nothing has changed. It still says I have v. 5.1.2 and the configure for the library still says it can't find 4.1.3 and above / try enabling c++.
The gmp files (such as gmp.h) are being placed in /usr/local/lib and /include
I've been at this for hours without any progress. I'm rather new to linux so I imagine there's something I just don't know about.
Am I not installing 6.0.0 correctly to overwrite the already installed one?
Or is there a way to reinstall the original with the c++ option?
Any help would be appreciated. Thanks.
dnf install gmp-devel resolved this for me on rhel
When you manually install something, as you have, it doesn't get installed in the normal /usr/lib directory and therefore it doesn't overwrite it. This is a good thing. In general, you shouldn't mess with files installed by the package manager. (Except in the case that they are config files that are meant to be edited.)
When you install manually, it is installed to /usr/local/lib. Fortunately, GCC and other compilers don't care which directory something is installed in, they will find it (when it's in standard places like /usr/* or /usr/local/*).
Just include the C++ header and add the correct -l library flag.
I figured it out.
Under the --help section of the ./configure for the library I was trying to install, there was actually a feature just for this:
--with-gmp-include=DIR
--with-gmp-lib=DIR
Using these, I was able to get it to install.
Thanks for the help.
I think I was too focused on trying to update the system install of gmp.