Opened 11 years ago
Last modified 11 years ago
#12 new defect
Build error with CERN ROOT 5.34/21
| Reported by: | smueller | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | milestone: |
| Component: | component1 | Version: | |
| Keywords: | Cc: |
Description
When building Mars using the latest and recommended (November 2014) CERN ROOT version 5.34/21 on Ubuntu 14.04 64bit, there are build errors concerning mbase/MQuarternion.h and msim/MPhotonData.h. In both these header files the sqrt() is 'redefined' from 'sqrt' to 'sqrt ::sqrt'.
In the header files it looks like:
#ifndef ROOT_TQuaternion #include <math.h> #define sqrt ::sqrt #include <TQuaternion.h> #undef sqrt #endif
The build error looks like:
In file included from MPhotonData.cc:43:0:
/usr/include/c++/4.8/bits/random.h: In member function ‘std::student_t_distribution<_RealType>::result_type std::student_t_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&)’:
MPhotonData.h:20:14: error: expected unqualified-id before ‘::’ token
#define sqrt ::sqrt
^
Note:
See TracTickets
for help on using tickets.

I found a possible solution. But for now I only know this is running with my CERN Root version 5.34/21. How ever a valid solution should work for them all.
I tried to use the
ROOT_VERSION(XX,XX,XX)function to fix this. I use it like this:#include "RVersion.h" #ifndef ROOT_TQuaternion #if ROOT_VERSION_CODE < ROOT_VERSION(5,34,21) #include <math.h> #define sqrt ::sqrt #include <TQuaternion.h> #undef sqrt #else #include <math.h> #include <TQuaternion.h> #endif #endifThe
#include "RVersion.h"is needed when there is no CERN Root include before theROOT_VERSION()But Root would not be Root without its pitfalls. This solution causes a different rootCINT related error.
Calling make in msim - Compiling SimCint.cc SimCint.cc: In function ‘void G__set_cpp_environmentSimCint()’: SimCint.cc:79:37: error: expected ‘}’ at end of input G__add_compiledheader("SimIncl.h"); ^ make[1]: *** [SimCint.o] Error 1 make: *** [msim.a] Error 2This latter turns out to be a 'well known bug'. See
http://root.cern.ch/phpBB3/viewtopic.php?t=5795
So I put a
-poption to the Mars Makefile.rules where the CINT is called:Now it is working on my machine. But further tests with different CERN Root versions might be needed.