Re: problem at compilation with a derivative of TSelector

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Wed, 14 Jul 2010 19:02:36 +0200


Hi,

> but i wish to compile mymain.C (g++ ...) : i do not wish to use "root
> command" to execute the macro but instead to type "mymain" to start the
> program. If i compile it (successfully), it crashes at executation at
> the line
> mychain_data->Process("SelectorTest.C")

The reason is most probably that the interpreter is not initialized and / or doesn't find its files. You can create a TApplication object to solve these problems, but CINT still needs to be able to find its files (ROOTSYS / configure with --prefix) and these files need to be there.

Cheers, Axel.

Marc Escalier wrote on 07/14/2010 12:54 PM:
> thanks Rene,
>

>> I cannot reproduce your problem with your version of SelectorTest.C.
>> Could you run the small program that I suggested yesterday.
>>  do:
>> root -l mymain.C
>> or
>> root > .x mymain.C
>> where mymain.C is:
>> int mymain()
>> {
>> TChain *mychain_data=new TChain("PAUReco");
>> mychain_data->Add("ntuple.root");
>>
>> return mychain_data->Process("SelectorTest.C");
>> }

>
> yes, using "root -l mymain.C", it works
>
> but i wish to compile mymain.C (g++ ...) : i do not wish to use "root
> command" to execute the macro but instead to type "mymain" to start the
> program. If i compile it (successfully), it crashes at executation at
> the line
> mychain_data->Process("SelectorTest.C")
>
>
> John Idarraga explained me kindly that it would use CINT when doing
> "mychain_data->Process("SelectorTest.C");"
> and that it would be the reason of the problem.
>
> he suggested me something like :
>
> gSystem->Load("SelectorTest_C.so")
> SelectorTest *c=new SelectorTest();
> mychain_data->Process(c);
>
> then it works in compiled mode
>
> His solution works fine,
> but i don't understand why the instruction
> mychain_data->Process("SelectorTest.C")
> crashes in a compiled program\
> )
>
> thanks for your patience
>
> ==============
> ==============
> ==============
> On Wed, 14 Jul 2010, Rene Brun wrote:
>
>> Salut Marc,
>>
>> Marc Escalier wrote:
>>> thanks Rene,
>>>
>>> it works, thanks to your help
>>>
>>> but if you have time, may i understand the following behaviour :
>>>
>>> *one produces a dictionnary .so, for example in a "non compiled"
>>> program with
>>> mychain_data->Process("SelectorTest.C+")
>>>
>> When you specify the "+, your file SelectorTest.C is COMPILED with the
>> normal compiler.
>> This is done via the ACLIC processor that
>>  -generates the dictionary file and compiles it
>> -compiles the file SelectorTest.C
>> -generates the shared lib SelectorTest.so out of the dictionary file
>> and SelectorTest.o
>>> *then, put the dependencies in the Makefile
>> You do not need a Makefile to do this. You better use root.exe that
>> does it automatically for you
>>>
>>> *then the compiled program works (doesn't crash) only if i put :
>>> mychain_data->Process("SelectorTest.C+")
>>>
>>> ==>whereas if i put in the compiled program :
>>> mychain_data->Process("SelectorTest.C") // here without the "+"
>>> because the .so yet exists.
>>>
>>> then it crashes :
>>> would you know why ?
>>>
>> I cannot reproduce your problem with your version of SelectorTest.C.
>> Could you run the small program that I suggested yesterday.
>>  do:
>> root -l mymain.C
>> or
>> root > .x mymain.C
>> where mymain.C is:
>> int mymain()
>> {
>> TChain *mychain_data=new TChain("PAUReco");
>> mychain_data->Add("ntuple.root");
>>
>> return mychain_data->Process("SelectorTest.C");
>> }
>>
>>
>> Rene
>>
>>
>>
>>> (just in case, full log here :
>>> /afs/cern.ch/user/e/escalier/public/MinimalSelector
>>>
>>> it crashes at this instruction (of the compiled program) :
>>> mychain_data->Process("SelectorTest.C")
>>>
>>> putting some prints, i see that it doesn't do begin the "Begin" of
>>> the selector
>>>
>>> i put a complete log : "crash.txt"
>>> (i had to do LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. before to launch the
>>> program
>>> )
>>>
>>>  *** Break *** segmentation violation
>>> Attaching to program: /proc/14683/exe, process 14683
>>> [Thread debugging using libthread_db enabled]
>>> 0xffffe410 in __kernel_vsyscall ()
>>> #1  0x00c9b5b3 in __waitpid_nocancel () from /lib/libc.so.6
>>> #2  0x00c4007b in do_system () from /lib/libc.so.6
>>> #3  0x00da3ead in system () from /lib/libpthread.so.0
>>> #4  0xf7a7a11d in TUnixSystem::Exec(char const*) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCore.so
>>> #5  0xf7a7f62b in TUnixSystem::StackTrace() ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCore.so
>>> #6  0xf7a803cd in TUnixSystem::DispatchSignals(ESignals) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCore.so
>>> #7  0xf7a804cd in SigHandler(ESignals) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCore.so
>>> #8  0xf7a76d82 in sighandler(int) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCore.so
>>> #9  <signal handler called>
>>> #10 0x00c6428a in _IO_seekpos_unlocked () from /lib/libc.so.6
>>> #11 0x00c62cc9 in fsetpos@@GLIBC_2.2 () from /lib/libc.so.6
>>> #12 0xf722d33c in G__interpret_func ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCint.so
>>> #13 0xf71d0be0 in Cint::G__CallFunc::ExecInterpretedFunc(G__value*) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCint.so
>>> #14 0xf71d0de7 in Cint::G__CallFunc::Execute(void*) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCint.so
>>> #15 0xf7a63a1b in TCint::CallFunc_ExecInt(void*, void*) const ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libCore.so
>>> #16 0xf65fedae in TSelectorCint::Begin(TTree*) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libTree.so
>>> #17 0xf4c39fa0 in TTreePlayer::Process(TSelector*, char const*, long
>>> long, long long) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libTreePlayer.so
>>> #18 0xf4c39b35 in TTreePlayer::Process(char const*, char const*, long
>>> long, long long) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libTreePlayer.so
>>> #19 0xf660ac36 in TTree::Process(char const*, char const*, long long,
>>> long long) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libTree.so
>>> #20 0xf65dece9 in TChain::Process(char const*, char const*, long
>>> long, long long) ()
>>>    from
>>> /afs/cern.ch/atlas/software/builds/DetCommon/15.6.9/InstallArea/i686-slc5-gcc43-opt/lib/libTree.so
>>> #21 0x0804b253 in main ()
>>> A debugging session is active.
>>>
>>>         Inferior 1 [process 14683] will be detached.)
>>>
>>> ==========================================
>>> ==========================================
>>> ==========================================
>>> On Tue, 13 Jul 2010, Rene Brun wrote:
>>>
>>>> Marc,
>>>>
>>>> You need to generate a dictionary for your selector class. If you do
>>>> not know how to do it, I strongly recommend to use ACLIC in teh
>>>> following way that will automatically generate the dictionary for
>>>> you and also the processing will be faster.
>>>>
>>>> Replace your main.C by mymain.C as
>>>> int mymain()
>>>> {
>>>> TChain *mychain_data=new TChain("PAUReco");
>>>> mychain_data->Add("ntuple.root");
>>>>
>>>> return mychain_data->Process("SelectorTest.C+"); //note the "+"
>>>> }
>>>>
>>>> and execute it with
>>>> root -l mymain.C
>>>>
>>>> Rene Brun
>>>>
>>>> Marc Escalier wrote:
>>>>> Dear Rooters,
>>>>>
>>>>> i occur a problem of compilation when using a class created with a
>>>>> MakeSelector :
>>>>>
>>>>> SelectorTest.o: In function `SelectorTest::IsA() const':
>>>>> SelectorTest.C:(.text._ZNK12SelectorTest3IsAEv[SelectorTest::IsA()
>>>>> const]+0x7): undefined reference to `SelectorTest::Class()'
>>>>> SelectorTest.o:(.rodata._ZTV12SelectorTest[vtable for
>>>>> SelectorTest]+0xe8): undefined reference to
>>>>> `SelectorTest::ShowMembers(TMemberInspector&, char*)'
>>>>> SelectorTest.o:(.rodata._ZTV12SelectorTest[vtable for
>>>>> SelectorTest]+0xec): undefined reference to
>>>>> `SelectorTest::Streamer(TBuffer&)'
>>>>>
>>>>> while i don't occur with one created with MakeClass()
>>>>>
>>>>> Theses members are not in the class SelectorTest but rather in the
>>>>> TObject from which SelectorTest derivates
>>>>> An expert told me that the reason would be that the class created
>>>>> by MakeSelector would derive from "TObject"...
>>>>>
>>>>> would you have an idea of what is missing in my code and/or Makefile ?
>>>>>
>>>>> To make you loose the less time possible, i provide a very minimum
>>>>> standalone example here :
>>>>> lxplus :
>>>>>
>>>>> /afs/cern.ch/user/e/escalier/public/MinimalSelector
>>>>>
>>>>> any suggestion would be appreciated
>>>>>
>>>>> Thank you
>>>>>
>>>>> (
>>>>> just in case you would not have time to see the code on lxplus, the
>>>>> Makefile is :
>>>>> main: SelectorTest.o main.o
>>>>>       /bin/rm -f main
>>>>>       g++ -o main `root-config --ldflags --libs --glibs` -lRooFit
>>>>> -lRooFitCore -lMinuit main.o SelectorTest.o
>>>>>
>>>>> SelectorTest.o: SelectorTest.C
>>>>>       g++ -c `root-config --cflags` SelectorTest.C
>>>>>
>>>>> main.o: main.C
>>>>>       g++ -c `root-config --cflags` main.C
>>>>>
>>>>> clean: /bin/rm *.o
>>>>> )
>>>>>
>>>>
>>>>
>>>
>>
>>

>
>
Received on Wed Jul 14 2010 - 19:02:42 CEST

This archive was generated by hypermail 2.2.0 : Thu Jul 15 2010 - 05:50:01 CEST