How to install a newer version of libstdc++ on Centos 7 - c++

I am running an application and it throws me an error saying:
"C++ header 'string_view' is required. You need to install a newer libstdc++ on the host system."
Can someone guide me on what I need to do to get a newer version of "libstdc++" on my machine?
Thanks

Try running yum provides libstdc++ to show you what package provided the library on your system. You can then check if those packages are available for update using yum list available | grep <that package> followed by yum update <that package>.

Facing the same issue, I built gcc from source. This way you get to choose your own version. It's actually pretty straightforard -- see Building GCC at https://gcc.gnu.org/wiki/InstallingGCC.

Related

Install older gcc/g++ versions in CentOS 8

I've been struggling with this for the past 2h. In CentOS 8 I can't find the devtoolset packages to install older gcc/g++ versions. There is no longer a scl repo for CentOS 8. I need gcc/g++ 4.9x installed along the current gcc/g++ 8.x and I need to be able to switch between the two. This was extremely easy to set up in Ubuntu, not the case in CentOS and the documentation is non-existent or I had trouble finding it.
If you wish to install an older gcc than the distro provides, you will need to compile it for source.
There is some guidance below on how to download and build an old GCC
https://bytefreaks.net/gnulinux/downgrade-gcc-on-centos-7-0-64bit-to-version-4-8-2
Found a solid path that has automated compiling and packaging gcc, as well as a guide:
Guide:
https://bobsteagall.com/2017/12/30/gcc-builder/
Github repo:
https://github.com/BobSteagall/gcc-builder
I won't copy paste what's in this person's guide as they deserve the credit. However, here's a summary of the steps:
Install your prereqs (rpm build tools, devtools for bootstrapping your environment).
Clone the repo.
Checkout a branch in the repo like the major version of GCC you want (e.g. gcc7).
In the repo, edit gcc-build-vars.sh such that it points to a version of GCC you want from http://gnu.mirror.constant.com/gcc/.
Perform the build with: ./build-gcc.sh -T | tee build.log.
Stage it: ./stage-gcc.sh.
Package it: (./pack-gcc.sh or ./make-gcc-rpm.sh -v).

Armel cross-compilation on Debian (toolchain repository problem)

I am compiling some code from armel architecture using Debian toolchain. I have found this page https://wiki.debian.org/CrossToolchains however, when I am failing to get an archive toolchain key using command from the instructions:
curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -
Seems that repository http://emdebian.org/tools/debian is not available anymore. Does anybody knows is there any issues with is now?
Thanks in advance.
As it explains on the debian page, the Emdebian is not supported anymore and it is suggested to use CrossToolchains package instead.
Based on this page, you may use arm-linux-gnueabihf as it supports ARM v6 and v7 as you need.

How to use the latest openssl update?

I have openssl 0.9.8g installed on my computer...
It seems that it has a known bug which I ran into.
I wanted to install the current version 1.0.0d which seems to have fixed the bug.
so, basic install :
$ ./config
$ make
$ sudo make install
However even after recompiled my software I still get the same error, and it is for sure coming from 0.9.8 since it is written in the error :
error:1408F06B:SSL
routines:SSL3_GET_RECORD:bad
decompression:/SourceCache/OpenSSL098/OpenSSL098-35/src/ssl/s3_pkt.c:438:
Let's assume you installed your downloaded version of OpenSSL to /home/yourname/openssl. Then you need to tell your software to use that custom install instead of the pre-packaged 0.9.8 that already resides on your file system. There's no need to uninstall that, you can have several installations on your machine. "Telling" your software where to find your custom installation is by providing the linker with the correct paths where to find libssl and libcrypto. Add these to the linking options in your Makefile:
-L/home/yourname/openssl/lib -Wl,-R/home/yourname/openssl/lib
Then it should link against the new version just fine. To verify it did, you can use
ldd <your_executable_or_library>
and verify that the custom OpenSSL path is listed there and not the old one.
I'm not sure about the OS you are using, but my guess is that you first have to remove the erroneous old version before you move on the install the newer one. Some OSes don't put libraries installed with sudo make install in the same place as with a packet manager. Also the lookup order of the libraries might cause it to load the older one.

how do i build gcc on a mac?

I'd like to build the latest version of gcc on a mac. I have the latest xcode but I'm looking for some of the c++0x features that are in more recent versions (the lambda functions, etc).
Are there any good step-by-step tutorials on doing this?
You should look at the Homebrew project.
Homebrew allows you to do things like this:
brew install gcc
Mac homebrew installation instructions are available here.
Add GCC support to a fresh Xcode 4.2 installation using this homebrew formula:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
Upgrading from Xcode 4.1 doesn't drop existing GCC support, so this formula is only useful if you're working with a fresh 4.2+ installation.
One option is to install MacPorts and install the gcc46 package:
sudo port install gcc46
Another option is to download the source code and build it as follows:
tar xzvf gcc-4.6.0.tar.gz
cd gcc-4.6.0
./configure
make
Note that GCC 4.6.0 requires as prerequisites GMP 4.2+, MPFR 2.3.1+, and MPC 0.8.0+. If ./configure fails, it's probably because you're missing one of these (though it should give you a helpful error message in any case).
Building will take a while—likely several hours, depending on your hardware.
I would suggest building it yourself (Adam details how to do so). This will give you fine control on where to install and all the options you want to select. My experience from having multiple versions of gcc is that, if care is not taken apple's version of gcc can be damaged.
To speed up gcc installation you might want to look at --enable-languages option. If there are languages you don't need installed with the new gcc then you may not want to select them.

Specify which version to install with macports

I would like to install a specific version of gdb and gcc with macports on mac os x leopard, not the last one, but the 6.8 for gdb. Is it possible?
It is possible. It's just convoluted and tedious. It's listed in the documentation these days.
Steps
Go to macports trac and find the package you're looking for. This is the link for subversion, which is the package I'll be using in the example.
Click the PortFile
Click Revision Log (top right)
Pour through the revisions until you find the version you're looking for. Remember the revision number.
In this example I'm looking for version 1.7 of subversion.
With that revision number noted. You need to checkout the version of that subdirectory at that revision.
cd /tmp
svn co http://svn.macports.org/repository/macports/trunk/dports/devel/subversion --revision 106629
Then cd into the folder and run the install
cd subversion
sudo port install
Then it should become selected by default. You can check with
sudo port installed subversion
The following ports are currently installed:
subversion #1.7.10_0 (active)
subversion #1.8.8_0
subversion #1.8.10_0
As I just came across this question when trying to figure out how to download an older version of curl, I thought I'd share an update:
The currently accepted answer did not work for me any longer. This is with MacPorts 2.2.0. What I did was the following.
I started following the directions located here. I ended up using the SVN method, since the first method didn't work. What I didn't realize is that I was missing a critical step.
I found another post that suggested moving the downloaded directory to /private/tmp. After doing this, I cd into the new directory and after a sudo port install I was able to install the older version.
I am on a Mac running OS X 10.8, so your mileage may vary.
This post is old.. but specifying a version is possible. For example I want to install ZeroMQ version 3.2.2 so I use:
sudo port install zmq #3.2.2
And it always helps to goto the MacPorts website and search to see if they have what you are looking for.
As far as I know it is not possible at all to install other versions than the exact version, unless there is a specific port for a certain version.
The only thing you could do is fetch the portfile of the desired version from the Macports subversion repository.
In your case only gdb 7.2 is available on the current version, no variants and no other versions - sorry :)