Rootcling doesn't have c++11 while root was compiled with it

Hello,

I compiled ROOT6 with the options “cmake -Dunuran=ON -Droofit=ON -Dmathmore=ON -Dcxx11=ON -Dhttp=ON -DCMAKE_BUILD_TYPE=Release”, with gcc version 4.8.5 (on redhat).

When I launch the root shell, I can use lambdas and all the c++11 stuff, but when I use rootcling to compile the dictionary for my library, the c++11 features are not available anymore. For example, I get the error

/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_vector.h:1075:7: note: candidate function not viable: no known conversion from '__normal_iterator<const_pointer, [...]>' to
      '__normal_iterator<pointer, [...]>' for 1st argument
      erase(iterator __position);

The same code compiled fine on an another machine where root was compiled with the same flags. Any ideas on how to solve this problem?

Hi Leonid,

this is probably due to some misconfiguration. Rootcling uses the very same interpreter of ROOT. Could you double check that your environment is ok?

Cheers,
D

I recompiled root again, and obtained the same errors. Are there some logs that I can check to see if the configuration of root is correct? Or maybe some commands to launch?

Hi,

what os are you on? What root version? What is your cmake command?

D

I compiled ROOT6 with the options “cmake -Dunuran=ON -Droofit=ON -Dmathmore=ON -Dcxx11=ON -Dhttp=ON -DCMAKE_BUILD_TYPE=Release”, with gcc version 4.8.5 (on redhat).

In particular, I see this in the output:

-- Found GCC. Major version 4, minor version 8
-- Performing Test CXX_SUPPORTS_OLD_ABI
-- Performing Test CXX_SUPPORTS_OLD_ABI - Success
-- Performing Test HAS_CXX11
-- Performing Test HAS_CXX11 - Success

and

-- Compiler Flags:  -pipe -m64 -Wall -W -Woverloaded-virtual -fsigned-char -fPIC -pthread -std=c++11 -Wno-deprecated-declarations -O2 -DNDEBUG

Hi,

this is odd.
do you have several compilers installed on the node?

Cheers,
D

And can you add this line to your header that you generate your dictionary for:

#if __cplusplus < 201103
# error "rootcling really has C++11 disabled!"
#else
# error "rootcling has C++11 enabled just fine."
#endif 

Axel.

@dpiparo I don’t think we have multiple compilers.

@Axel Interesting, I obtained

error: "rootcling has C++11 enabled just fine."

Looks like it’s a gcc bug. I actually use a lot of c++11 features but it looks like only this thing with std::vector::erase arises. I will try with gcc 4.9 today.

Indeed, GCC 4.8’s C++11 support is limited.

Axel.

This problem is solved with gcc-4.9.4.

Thanks for the help,

Leonid