Error compiling ROOT 6 in Debian7 with gcc 4.8 installed

Dear Experts

I recently intalled a [color=#0040FF]64bit Debian7[/color] release wich comes standard with [color=#0040FF]gcc 4.7[/color]. After a failed attempt at installing ROOT 6.02.05 and some digging around I realised that I needed to [color=#0000FF]update to gcc 4.8[/color]. I did this with:

../gcc-4.8.2/configure --prefix=/home/user/gcc-4.8.2 make make install
Everything seemed to run ok.
I therefore now have TWO ggc versions which I can alternate with:

If I type gcc -v I see:

gcc version 4.8.2 (GCC) 

so I know I am using 4.8.2 to compile.

However, [color=#FF0000]when compiling ROOT 6 [/color] I get some warnings:

MergedLoadStoreMotion.cpp:50:1: warning: multi-line comment [-Wcomment] SemaDeclCXX.cpp:466:16:warning: variable ‘DiagDefaultParamID’ set but not used [-Wunused-but-set-variable] followed by[color=#FF0000] errors[/color], the first of which are:

In file included from /home/user/root-6.02.05/core/utils/src/rootcling.cxx:260:0: /home/user/root-6.02.05/core/utils/src/OptionParser.h:236:1: error: ‘namespace option { }’ redeclared as different kind of symbol { ^ In file included from /usr/include/unistd.h:890:0, from include/strlcpy.h:21, from include/Rtypes.h:36, from /home/user/root-6.02.05/core/utils/src/rootcling.cxx:249: /home/user/gcc-4.8.2/include/getopt.h:82:8: error: previous declaration of ‘struct option’ struct option
Various errors in rootcling.cxx, OptionParser.h, etc. follow.


I am using all the packages suggested for an Ubuntu type install, and I tried the same build on a [color=#0040FF]ROOT 5.32.04[/color] version with [color=#0040FF]gcc 4.8[/color] and [color=#0040FF]IT WORKED NO PROBLEM[/color].

I have tried to specify the gcc directory using --with-gcc-toolchain but I can’t get it to work, plus I dont think it is a gcc issue since ROOT 5 works.

Let me know if anyone has any idea or suggestions I could try.




this seems to be some sort of conflict between the simple commandline parser of rootcling and something related with the unistd.h file of your installation.
Could you share the exact configure command you used?
Could you also try to build with CMake, share the cmake command you used and the result?
Additionally, what do you exactly mean by " --with-gcc-toolchain but I can’t get it to work"?



just to add a little detail.
This behaviour is not present in the 6.03/02 release and master, for which a refactoring of the option parser took place.



just to mark this thread as solved, the fix for debian7 was ported to the 6.00.patches branch. It will be available for 6.02.06.


Dear Danilo

Thank you for following up on this and appologies for the late reply.

I was able to find a way to compile ROOT 6 successfully early this morning after a clean install of gcc and g++ 4.9 which I installed from the Debian testing (jessie) repositories, as well as installing the prerequisite packages from there. It seems to me like it may have been a dependancy problem.

Kind regards