Re: Error when running macro twice - compile macro?

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 2 Jun 2010 09:55:09 -0500


 > where it was suggested to compile the macros

You just need to do:

       root -q -d myMacro.c+\(input1\) myMacro.c+\(input2\)

You can also avoid the reloading altogether and do:

     echo 'gROOT->ProcessLine(".L myMacro.C"); myMacro(2); myMacro(3);' | root.exe -b -l
or

     echo 'gROOT->ProcessLine(".L myMacro.C+"); myMacro(2); myMacro(3);' | root.exe -b -l

Cheers,
Philippe.

On 5/31/10 4:17 AM, Ida Häggström wrote:
> Hi Rooters!
> I'm running a C-macro in ROOT which works without any problems.
>
> >> root -q -d myMacro.c\(input1\)
> yields:
> -------------------------------------------------
> Processing myMacro.C(input1)...
> ...stuff...
> Finished!
> -------------------------------------------------
>
> When I try to run it twice I get some warnings however, and running it
> three times I get segmentation violations. I found a similar post from
> 2005 (http://root.cern.ch/root/roottalk/roottalk05/1381.html) where it
> was suggested to compile the macros. Is this a good idea, and how
> would I do that? Thanks in advance!
> Ida
>
> >> root -q -d myMacro.c\(input1\) myMacro.c\(input2\)
> yields:
> -------------------------------------------------
> Processing myMacro.C(input1)...
> ...stuff...
> Finished!
>
> Processing myMacro.C(input2)...
> Warning: template pair duplicate definition
> /home/ida/GATE/ROOT_v5.24/root/lib/root/cint/cint/stl/_pair.h:31:
> Warning: template reverse_iterator duplicate definition
> /home/ida/GATE/ROOT_v5.24/root/lib/root/cint/cint/stl/_iterator.h:269:
> Warning: template vector duplicate definition
> /home/ida/GATE/ROOT_v5.24/root/lib/root/cint/cint/stl/_vector.h:44:
> ...stuff...
> Finished!
> -------------------------------------------------
> >> root -q -d myMacro.c\(input1\) myMacro.c\(input2\) myMacro.c\(input3\)
> yields:
> -------------------------------------------------
> Processing myMacro.C(input1)...
> ...stuff...
> Finished!
>
> Processing myMacro.C(input2)...
> Warning: template pair duplicate definition
> /home/ida/GATE/ROOT_v5.24/root/lib/root/cint/cint/stl/_pair.h:31:
> Warning: template reverse_iterator duplicate definition
> /home/ida/GATE/ROOT_v5.24/root/lib/root/cint/cint/stl/_iterator.h:269:
> Warning: template vector duplicate definition
> /home/ida/GATE/ROOT_v5.24/root/lib/root/cint/cint/stl/_vector.h:44:
> ...stuff...
> Finished!
>
> Processing myMacro.C(input3)...
> *** Break *** segmentation violation
> (no debugging symbols found)
> Attaching to program: /proc/22686/exe, process 22686
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> [Thread debugging using libthread_db enabled]
> [New Thread 0xb7fbe8e0 (LWP 22686)]
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)
> 0x00b5c402 in __kernel_vsyscall ()
> #1 0x00a974a3 in __waitpid_nocancel () from /lib/libc.so.6
> #2 0x00a3c07b in do_system () from /lib/libc.so.6
> #3 0x009fbccd in system () from /lib/libpthread.so.0
> #4 0x00317ead in TUnixSystem::Exec ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #5 0x0031ea56 in TUnixSystem::StackTrace ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #6 0x0031c7ce in TUnixSystem::DispatchSignals ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #7 0x0031c89d in SigHandler () from
> /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #8 0x003157b4 in sighandler () from
> /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #9 <signal handler called>
> #10 0x00cd1024 in G__destroy_upto () from
> /home/ida/GATE/ROOT_v5.24/root/lib/root/libCint.so
> #11 0x00cd2c5c in G__scratch_upto_work ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCint.so
> #12 0x00cd2cf5 in G__scratch_upto () from
> /home/ida/GATE/ROOT_v5.24/root/lib/root/libCint.so
> #13 0x00c463c9 in G__unloadfile () from
> /home/ida/GATE/ROOT_v5.24/root/lib/root/libCint.so
> #14 0x00c9506a in G__process_cmd () from
> /home/ida/GATE/ROOT_v5.24/root/lib/root/libCint.so
> #15 0x00305cd5 in TCint::ProcessLine ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #16 0x0030af5f in TCint::ProcessLineSynch ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #17 0x0022f2a2 in TApplication::ExecuteFile ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #18 0x0022f81c in TApplication::ProcessFile ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #19 0x0022cd15 in TApplication::ProcessLine ()
> from /home/ida/GATE/ROOT_v5.24/root/lib/root/libCore.so
> #20 0x00987169 in TRint::Run () from
> /home/ida/GATE/ROOT_v5.24/root/lib/root/libRint.so
> #21 0x08048d83 in main ()
> The program is running. Quit anyway (and detach it)? (y or n)
> [answered Y; input not from terminal]
> Detaching from program: /proc/22686/exe, process 22686
> -------------------------------------------------
Received on Wed Jun 02 2010 - 16:55:15 CEST

This archive was generated by hypermail 2.2.0 : Wed Jun 02 2010 - 23:50:01 CEST