ROOT 6 build from source error gcc 4.7.2

When trying to build ROOT6 from source in debian wheezy, I get the following compilation error:

g++ -O2 -DNDEBUG -pipe -m64 -std=c++11 -Wshadow -Wall -W -Woverloaded-virtual -fPIC -Iinclude  -Wno-deprecated-declarations  -pthread  -Icore/base/src -MMD -MP -o core/meta/src/TIsAProxy.o -c /opt/root6/core/meta/src/TIsAProxy.cxx
/opt/root6/core/meta/src/TIsAProxy.cxx:170:20: error: ‘class std::map<const void*, TClass*>’ has no member named ‘emplace’
/opt/root6/core/meta/src/TIsAProxy.cxx:170:36: error: unable to deduce ‘auto’ from ‘<expression error>’
/opt/root6/core/meta/src/TIsAProxy.cxx:178:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [core/meta/src/TIsAProxy.o] Error 1

I googled, and this is because the gcc version with wheezy is 4.7.2. But it seems not easy to upgrade to 4.8. Is it possible at all then to compile with wheezy? Any idea? If not, maybe add in the “configure” script some flag to stop from doing all the compilation if gcc<4.8 (otherwise you get the error after one hour of compiling things…). Thanks.

Hi,

ROOT 6 requires GCC 4.8.

Cheers, Axel.

Ok, thanks.

Then I suggest to add in the ./configure script some break flag if it detects gcc lower versions.

Hi,

yes, I’m surprised we don’t have that or that it doesn’t trigger :frowning: Let me check that (on Monday).

Thanks for your suggestion!

Cheers, Axel.

Hi,

Okay so we do check, but using the compiler flag -std=c++11 - that’s the right approach, because we want to support all kinds of compilers here. And sadly, GCC 4.7.2 claims to do -std=c++11.

I’d suggest to leave it as is, instead of introducing checks on compiler versions.

Cheers, Axel.

Thanks for your reply.

After some work, I managed to install ROOT v6.07.03 in Debian wheezy.

I post here my solution, in case someone wants to do the same.

First, I built gcc-4.9 from source in a fixed location, /opt in my case:

cd /opt/
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
#Check also with printenv, /usr/local/lib and so on... that you do not have any extra personal libraries intefering...
wget http://ftp.gnu.org/gnu/gcc/gcc-4.9.2/gcc-4.9.2.tar.gz
tar xzvf gcc-4.9.2.tar.gz
cd gcc-4.9.2
./contrib/download_prerequisites
#Alternatively, sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev
cd -
mkdir gcc-4.9_build
mkdir gcc-4.9
cd gcc-4.9_build
/opt/gcc-4.9.2/configure --prefix=/opt/gcc-4.9 --disable-multilib
make -j8
make install
#See http://stackoverflow.com/questions/23312047/how-do-i-compile-and-run-gcc-4-9-x
#See http://stackoverflow.com/questions/29981492/gcc-4-9-2-installation-failed-on-linux

Then, I check the prerequisites root.cern.ch/build-prerequisites, I also install ccache, and then I install ROOT from git master with CMake, specifying the actual compiler

sudo apt-get install git dpkg-dev make g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev
sudo apt-get install gfortran libssl-dev libpcre3-dev \
xlibmesa-glu-dev libglew1.5-dev libftgl-dev \
libmysqlclient-dev libfftw3-dev cfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev python-dev libxml2-dev libkrb5-dev \
libgsl0-dev libqt4-dev ccache

cd /opt/
mkdir root6
cd root6
git clone http://root.cern.ch/git/root.git root6_src
#Check again that environment is clean, and then export your local libstdc++
export LD_LIBRARY_PATH=/opt/gcc-4.9/lib64/
cmake -Droofit=ON -Dhttp=ON -Dccache=ON -DCMAKE_CXX_COMPILER=/opt/gcc-4.9/bin/g++ -DCMAKE_C_COMPILER=/opt/gcc-4.9/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/gcc-4.9/bin/gfortran /opt/root6/root6_src/
cmake --build .
#If you are in a hurry, then use instead: make -j8

Finally, whenever you want to use ROOT, type this (or write in your ~/.bashrc)

unset CPLUS_INCLUDE_PATH
export PATH=/opt/gcc-4.9/bin/:$PATH
export LD_LIBRARY_PATH=/opt/gcc-4.9/lib64/:$LD_LIBRARY_PATH
source /opt/root6/bin/thisroot.sh
# Or add previous line to ~/.bashrc
root
#root --notebook works also