Problem compiling against root

Dear root support,
I’ve successfully build a macro locally on my laptop against root and roounfold and run it.
For larger data processing I need to run it now remote on a tier 2 machine. I have problems compiling it. I work in a so called cms envirnoment.
locally I compile it against root and roounfold with clang (on macbook with XTools):

Local software on mac:
clang -v
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.6.0
Thread model: posix
root: root-6.05.02/
roofunfold: RooUnfold-1.1.1

I try to use compile on tier2 (in cms environment) against:
root: 5.32.00
roofunfold: RooUnfold-1.1.1
gcc: gcc472
(for futher info, I put output of printenv in attachment)
The compiler gives the following errors about the root Clone function and Copy function (it complains many times about copy, I do this often):

UnfoldMC_RedChiBackSmeared.cc:277:49: error: invalid conversion from ‘TObject*’ to ‘TH1F*’ [-fpermissive]
In file included from /cvmfs/cms.cern.ch/slc6_amd64_gcc472/cms/cmssw/CMSSW_5_3_32/external/slc6_amd64_gcc472/bin/…/…/…/…/…/…/lcg/root/5.32.00-cms/include/TH1F.h:25:0,
from UnfoldMC_RedChiBackSmeared.cc:16:
/cvmfs/cms.cern.ch/slc6_amd64_gcc472/cms/cmssw/CMSSW_5_3_32/external/slc6_amd64_gcc472/bin/…/…/…/…/…/…/lcg/root/5.32.00-cms/include/TH1.h:124:21: error: ‘virtual void TH1::Copy(TObject&) const’ is protected
UnfoldMC_RedChiBackSmeared.cc:318:31: error: within this context

THis are the offending terms in the code:
277:
TH1F* fakecheck=scaledfakes->Clone(“fakecheck”);
//line 318
TH1F* FakeS=new TH1F();
scaledfakes->Copy(*FakeS);
Perturb1DHisto(FakeS);

My compiler flags (I’ve made sure header path and LDFLAGS point to correct include and library dirs):

CXXFLAGS+=(shell root-config --cflags) -Wall -I(HeaderPath) -ggdb3 -fPIC -Wno-overloaded-virtual -Wno-unused-variable

LDFLAGS+=-L$(libUnfold) -ggdb3
LDFLAGS+=$(shell root-config --glibs) -ggdb3

Build
all:
(CXX) -g UnfoldMC_RedChiBackSmeared.cc (CXXFLAGS) < (LDFLAGS) -o UnfoldMC_RedChiBackSmeared

Strangely, when I start root and load the libraries (gSystem->Load()) I can compile and run the macro. I would prefer to be able to compile it standalone though (my normal way of working…)
Cheers
Merijn
PS: I’ve also tried to do it without the cms environment, just using
/cvmfs/cms.cern.ch/crab3/slc6_amd64_gcc493/external/gcc/4.9.3/bin/gcc
as compiler.
compiled root v5-32-01 with it, but now roounfold won’t compile:
/cvmfs/cms.cern.ch/crab3/slc6_amd64_gcc493/external/gcc/4.9.3/include/c++/4.9.3/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

/storage_mnt/storage/user/mvandekl/UnfoldingPlay/NothingPreset/RooUnfold-1.1.1/src/RooUnfoldSvd.cxx: In member function ‘virtual void RooUnfoldSvd::Streamer(TBuffer&)’:
/storage_mnt/storage/user/mvandekl/UnfoldingPlay/NothingPreset/RooUnfold-1.1.1/src/RooUnfoldSvd.cxx:225:11: error: invalid use of incomplete type ‘class TBuffer’
if (R__b.IsReading()) {
^
retried with first setting:
export CXXFLAGS+=’-stdlib=libc++ -std=c++11 -m64’
But didn’t solve it. Aside the buffer issue seems hard to get around. Any idea?
printenv.txt (25 KB)

Hi,

could you attach the macro and communicate the exact CMSSW version you are trying to use?

Cheers,
Danilo

Hi thanks for the reply. I’m using cmssw 5_3_32.
attached the macro (not cleaned up though, to stay consistent with the message below).
Cheers
Merijn
UnfoldMC_RedChiBackSmeared.cc (48.6 KB)

Hi Merijn,

I am in a CMSSW environment for 5_3_32*.
If I try to compile with Aclic, I get this error:

./UnfoldMC_RedChiBackSmeared.cc:32:31: fatal error: RooUnfoldResponse.h: No such file or directory

How can I reproduce your setup?

Danilo

cmsrel CMSSW_5_3_32
cd CMSSW_5_3_32
cmsenv

Hi thanks for giving it a try.
You first need to install and compile a roounfold distribution. I attached it to this message.
Just unpack and apply ./configure make
(note cmsenv needs to be set first since it needs to find root).
Next one needs to set the paths, such that the make file knows where to find roounfold. Please attach below appropriately:

export ROOUNFOLD_LIB=/user/mvandekl/UnfoldingPlay/CMSSW_5_3_32/src/RooUnfold-1.1.1/lib
export ROOUNFOLD_INC=/user/mvandekl/UnfoldingPlay/CMSSW_5_3_32/src/RooUnfold-1.1.1/src

With this, I think you should be able to reproduce the error (just to be certain I attached my makefile as well, as .txt or it won’t attach…)
Hope it works and reproduces the error!
Cheers
Merijn
Makefile.txt (510 Bytes)
RooUnfold-1.1.1.tar.gz (81.7 KB)

Hi,

two observations:

  1. While compiling, RooUnfold prompts this message: “This version of ROOT does not support RooFit. We will build the test programs without it.” Not sure if this is relevant for your workflow, but it can be linked to the fact that RooFit is built in a special way for CMSSW releases based on ROOT5 (i.e. you can find more advanced roofit versions than the one associated to the ROOT release on which the CMS stack is based)
  2. You did not share the command (g++ invocation) you use to compile UnfoldMC_RedChiBackSmeared.cc . Without it I cannot reproduce your problem.

You have on your local setup root 6.05. In general I wonder if it would be better to move to a recent CMSSW release based on ROOT6.
Is there a reason why you use CMSSW? Would an afs based ROOT installation be good enough for you(see here*)?

Cheers,
Danilo

root.cern.ch/content/release-60602

Hi Danilo thanks for the reply.

-Absence of ROOFIT is no problem don’t need it.
-Concerning make: I might be mistaken, but if you run in CMSSW 5 3 32 I think all should be preset (note cmsenv needs to be applied first from the CMSSW environment!!!)

in the Makefile we see we compile with this rule:
all:
$(CXX) -g UnfoldMC_RedChiBackSmeared.cc $(CXXFLAGS) $< $(LDFLAGS) -o UnfoldMC_RedChiBackSmeared

the CXXFLAGS are defined in the macro:
-point to root and roounfold headers:
CXXFLAGS+=$(shell root-config --cflags) -Wall -I$(HeaderPath) -ggdb3 -fPIC -Wno-overloaded-virtual -Wno-unused-variable

I think CXX is just defined by the cms version we use. I prompted from the makefile CXX, it points to:
g++
in cmssw 5 3 32 we run with:
which gcc
/cvmfs/cms.cern.ch/slc6_amd64_gcc472/external/gcc/4.7.2-cms/bin/gcc
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/cvmfs/cms.cern.ch/slc6_amd64_gcc472/external/gcc/4.7.2-cms/bin/…/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: …/configure --prefix=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --disable-multilib --disable-nls --enable-languages=c,c++,fortran --enable-lto --with-gmp=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-mpfr=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-mpc=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-ppl=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-cloog=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --enable-cloog-backend=isl --enable-shared CC=‘gcc -fPIC’ CXX=‘c++ -fPIC’ CPP=cpp CXXCPP='c++ -E’
Thread model: posix
gcc version 4.7.2 (GCC)

which g++
/cvmfs/cms.cern.ch/slc6_amd64_gcc472/external/gcc/4.7.2-cms/bin/g++
which g++
/cvmfs/cms.cern.ch/slc6_amd64_gcc472/external/gcc/4.7.2-cms/bin/g++
-bash-4.1$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/cvmfs/cms.cern.ch/slc6_amd64_gcc472/external/gcc/4.7.2-cms/bin/…/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: …/configure --prefix=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --disable-multilib --disable-nls --enable-languages=c,c++,fortran --enable-lto --with-gmp=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-mpfr=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-mpc=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-ppl=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --with-cloog=/build/davidlt/build-CMSSW_6_2_0_pre3/tmp/BUILDROOT/e377d2e3d948dac329d9ab75ac3f2984/opt/cmssw/slc6_amd64_gcc472/external/gcc/4.7.2-cms --enable-cloog-backend=isl --enable-shared CC=‘gcc -fPIC’ CXX=‘c++ -fPIC’ CPP=cpp CXXCPP='c++ -E’
Thread model: posix
gcc version 4.7.2 (GCC)

I hope this helps for the compiler flags.

-tried (before posting here) cmssw 7_4_4. here I even can’t compile roounfold, many errors like this:
/cvmfs/cms.cern.ch/slc6_amd64_gcc491/external/gcc/4.9.1-cms/include/c++/4.9.1/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
tried to put -std=c++11 or -std=gnu++11 to compiler CXXFLAGS, didn’t got it to work though.

-A standalone root with roounfold would be fine for me, tried as well prior to posting. Didn’t got this to work though. On the tier2 machine I’m working on I have (if I set nothing related to cms):
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
I tried to compile root v5-32-00 with it. It fails: c++11 mode is requested but the current compiler does not support it.

I loaded some basic cms settings: via:
source $VO_CMS_SW_DIR/cmsset_default.sh

then we get different compiler but no root:
/cvmfs/cms.cern.ch/crab3/slc6_amd64_gcc493/external/gcc/4.9.3/bin/gcc

I FIRST put:
export CXXFLAGS+=’-stdlib=libc++ -std=c++11 -m64’
Now I compile root 5.32.01
./configure
make -j12
source bin/thisroot.sh

Now try to compile roounfold:
I get many of these errors:
/cvmfs/cms.cern.ch/crab3/slc6_amd64_gcc493/external/gcc/4.9.3/include/c++/4.9.3/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the
^
Aside it seems something is wrong with TBuffer:
Compiling /storage_mnt/storage/user/mvandekl/UnfoldingPlay/NothingPreset/RooUnfold-1.1.1/src/RooUnfoldParms.cxx
/storage_mnt/storage/user/mvandekl/UnfoldingPlay/NothingPreset/RooUnfold-1.1.1/src/RooUnfold.cxx: In member function ‘virtual void RooUnfold::Streamer(TBuffer&)’:
/storage_mnt/storage/user/mvandekl/UnfoldingPlay/NothingPreset/RooUnfold-1.1.1/src/RooUnfold.cxx:969:11: error: invalid use of incomplete type 'class TBuffer’
if (R__b.IsReading()) {
^
In file included from /user/mvandekl/UnfoldingPlay/NothingPreset/root/include/TObject.h:31:0,
from /user/mvandekl/UnfoldingPlay/NothingPreset/root/include/TNamed.h:26,
from /storage_mnt/storage/user/mvandekl/UnfoldingPlay/NothingPreset/RooUnfold-1.1.1/src/RooUnfold.h:15,
from /storage_mnt/storage/user/mvandekl/UnfoldingPlay/NothingPreset/RooUnfold-1.1.1/src/RooUnfold.cxx:65:
/user/mvandekl/UnfoldingPlay/NothingPreset/root/include/Rtypes.h:43:7: error: forward declaration of 'class TBuffer’
class TBuffer;

If you know how to get it to work on a (regular) tier2 machine (LXPLUS would be fine for me) I’d be happy…
Many thanks,
Merijn