Quote:
Could this be related to the compiler version?
That's quite probable. You might be able to solve it by trying different standard compliance versions. GCC 4.8 compiles by default as C++ 98, you could try setting
-std=c++11
for the compile and see if that helps. To do that, you will need probably need to re-run <configure> to set the C++ compiler flags. Normally this is something like
[user@host]$ CXXFLAGS=-std=c++11 ./configure
You'll have to consult the build instructions to find out exactly how to do that
Alternatively, you could try using clang++ instead of g++, but CentOS 7 only supplies clang 3.4.2, which also only supports c++11.
As you have access to a g++, you can always build a newer version of the compiler. I have successfully built g++ 12-1.0 for CentOS 7. There are several things to be aware of:
* You may need to download newer versions of mpfr, mpc and gmp. I always download the newest version of these when building a new compiler, and have them built as part of the compiler build. You may be able to get away with just adding the relevant devel packages to your CentOS 7 instance.
* If you do not have admin access, you will need to set things up to install somewhere you do have access - e.g. your home directory. That's achieved by adding
--prefix=$HOME
to the config arguments when building gcc.
* compilation of g++ requires about 4-5 G of disk space. There are options to configure to reduce the space requirement, but its something you should be aware of before you start.
* Expect compilation to take anywhere from 30 minutes to several hours, depending on your CPU. Things can be improved by telling make to use more than one core to compile e.g.
make -j$(nproc)
will use all available threads to compile.
* C++ code compiled with the new compiler will need to know where to find the appropriate libstdc++. If you don't mind larger executables, you can add
-static-libstdc++
to the
link flags for your project. This removes the requirement for executables to know where the g++-12 specific libraries are. Otherwise, you'll have to look at using something like LD_LIBRARY_PATH or using -rpath when linking. If you need to distribute the executables elswhere, I'd suggest using the static libstdc++ as this means you do not have to distribute libstdc++ along with your project.
It's also possible that your version of boost is too old. You may need to update both boost and the compiler. Most of what I've said about the compiler also applies to boost, but I'm not sure if boost will create static libraries when you build, which may be a deal breaker.
Everything you need to know about building g++ is available here
Installing GCC- GNU Project[
^]
Instructions for building boost are here:
Boost Getting Started on Unix Variants - 1.63.0[
^]