*** Break *** segmentation violation when using Divide()

Hello new user here, the code I try to produce is :

 TFile* f= new TFile ("simple.root");
  TTree* t;
  f-> GetObject ("t",t);

  TCanvas* c2= new TCanvas ("c2","my histo",500,900);
  c2-> Divide(1,2);

But when I use Divide I get this error:

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fc9f17c907a in __GI___waitpid (pid=16450, stat_loc=stat_loc
entry=0x7ffdfde3c140, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00007fc9f1741fbb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007fc9f2333034 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x216f4f0) at /home/stelios/myroot/root-6.08.06/core/unix/src/TUnixSystem.cxx:2118
#3  TUnixSystem::StackTrace (this=0x216f4f0) at /home/stelios/myroot/root-6.08.06/core/unix/src/TUnixSystem.cxx:2405
#4  0x00007fc9f233569c in TUnixSystem::DispatchSignals (this=0x216f4f0, sig=kSigSegmentationViolation) at /home/stelios/myroot/root-6.08.06/core/unix/src/TUnixSystem.cxx:3625
#5  <signal handler called>
#6  0x00007fc9da3a20b4 in ?? ()
#7  0x3c23d70afde3eb28 in ?? ()
#8  0x00007fc9ee10f900 in ?? () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#9  0x00000000021cf4e0 in ?? ()
#10 0x00000000038c5280 in ?? ()
#11 0x00007ffdfde3ee30 in ?? ()
#12 0x00007ffdfde3ee30 in ?? ()
#13 0x00007ffdfde3eae0 in ?? ()
#14 0x00007fc9ee11153f in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#15 0x00007fc9ee112f9d in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#16 0x00007fc9ee113250 in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#17 0x00007fc9ee19c48e in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#18 0x00007fc9ee08ca86 in HandleInterpreterException (metaProcessor=<optimized out>, input_line=<optimized out>, compRes=
0x7ffdfde3ee1c: cling::Interpreter::kSuccess, result=result
entry=0x7ffdfde3ee30) at /home/stelios/myroot/root-6.08.06/core/meta/src/TCling.cxx:1883
#19 0x00007fc9ee09da6a in TCling::ProcessLine (this=0x21c87c0, line=<optimized out>, error=0x7ffdfde3f33c) at /home/stelios/myroot/root-6.08.06/core/meta/src/TCling.cxx:2049
#20 0x00007fc9f2267be6 in TApplication::ProcessLine (this=this
entry=0x21ba4e0, line=<optimized out>, sync=sync
entry=false, err=err
entry=0x7ffdfde3f33c) at /home/stelios/myroot/root-6.08.06/core/base/src/TApplication.cxx:1005
#21 0x00007fc9f268e7ce in TRint::ProcessLineNr (this=this
entry=0x21ba4e0, filestem=filestem
entry=0x7fc9f269d086 "ROOT_prompt_", line=0x2cc5c40 "c5-> Divide(1,2);", error=0x7ffdfde3f33c, error
entry=0x0) at /home/stelios/myroot/root-6.08.06/core/rint/src/TRint.cxx:749
#22 0x00007fc9f268eb55 in TRint::HandleTermInput (this=0x21ba4e0) at /home/stelios/myroot/root-6.08.06/core/rint/src/TRint.cxx:610
#23 0x00007fc9f2334b8c in TUnixSystem::CheckDescriptors (this=this
entry=0x216f4f0) at /home/stelios/myroot/root-6.08.06/core/unix/src/TUnixSystem.cxx:1321
#24 0x00007fc9f2335fca in TUnixSystem::DispatchOneEvent (this=0x216f4f0, pendingOnly=<optimized out>) at /home/stelios/myroot/root-6.08.06/core/unix/src/TUnixSystem.cxx:1076
#25 0x00007fc9f226f1f4 in TSystem::InnerLoop (this=0x216f4f0) at /home/stelios/myroot/root-6.08.06/core/base/src/TSystem.cxx:408
#26 0x00007fc9f226dd2f in TSystem::Run (this=0x216f4f0) at /home/stelios/myroot/root-6.08.06/core/base/src/TSystem.cxx:358
#27 0x00007fc9f226511f in TApplication::Run (this=this
entry=0x21ba4e0, retrn=retrn
entry=false) at /home/stelios/myroot/root-6.08.06/core/base/src/TApplication.cxx:1157
#28 0x00007fc9f2690237 in TRint::Run (this=this
entry=0x21ba4e0, retrn=retrn
entry=false) at /home/stelios/myroot/root-6.08.06/core/rint/src/TRint.cxx:463
#29 0x000000000040108c in main (argc=1, argv=0x7ffdfde417a8) at /home/stelios/myroot/root-6.08.06/main/src/rmain.cxx:30
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x00007fc9da3a20b4 in ?? ()
#7  0x3c23d70afde3eb28 in ?? ()
#8  0x00007fc9ee10f900 in ?? () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#9  0x00000000021cf4e0 in ?? ()
#10 0x00000000038c5280 in ?? ()
#11 0x00007ffdfde3ee30 in ?? ()
#12 0x00007ffdfde3ee30 in ?? ()
#13 0x00007ffdfde3eae0 in ?? ()
#14 0x00007fc9ee11153f in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#15 0x00007fc9ee112f9d in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#16 0x00007fc9ee113250 in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#17 0x00007fc9ee19c48e in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /home/stelios/myroot/Stelios-root/lib/libCling.so
#18 0x00007fc9ee08ca86 in HandleInterpreterException (metaProcessor=<optimized out>, input_line=<optimized out>, compRes=
0x7ffdfde3ee1c: cling::Interpreter::kSuccess, result=result
entry=0x7ffdfde3ee30) at /home/stelios/myroot/root-6.08.06/core/meta/src/TCling.cxx:1883
===========================================================

Is there anyone who help me find what the problem is?
Thanks a lotsimple.root (1.0 MB)

I do not see the problem on my mac with the latest ROOT version.
I ran:

{
   TFile* f= new TFile ("simple.root");
   TTree* t;
   f-> GetObject ("t",t);
   TCanvas* c2= new TCanvas ("c2","my histo",500,900);
   c2-> Divide(1,2);
}
1 Like

It looks like a problem with linking or loading the libraries. Did you compile root yourself or do you have two versions installed at the same time?

First of all thanks for answering. What do you mean when writing: two versions installed at the same time cause I only have root-6.08.06 as far as I am concerned ?

I mean if you have two installations of root. For example, you could have root installed on your system (maybe the system administrators installed it centrally), and you started to compile another one. That’s just one of multiple options.

You didn’t reply to my other question:
Did you compile root yourself? Where does this particular version come from?

I have only one version of root: root-6.08.06 . If I get correctly what you ask I compiled root using cmake ( not sure if that’s what you wanna know) and yes I did it myself. As for the version it’s from cern’s site.
I feel like these were not the info you are asking but as I am quite new user.

Can you try to run the macro that @couet shows (without any modifications)?

BTW. In your first post here, you create the “c2” canvas but your error says “c5” inside.

P.S. ROOT 6.08/06 is extremely old … try the newest version and maybe you can use one of the ready-to-use binary distributions which are provided by the ROOT team, which you just need to download and unpack.

I run @couet 's macro and it is working. Myself I was running each line directly in the terminal and it was crashing, but now I did it as a macro and it is working. I don’t know why to be honest is there any reason?
As for the root version, do you suggest 6.16?

Also fine with me when I run it line by line:

$ root
   ------------------------------------------------------------
  | Welcome to ROOT 6.17/01                  https://root.cern |
  |                               (c) 1995-2019, The ROOT Team |
  | Built for macosx64 on Mar 14 2019, 10:02:14                |
  | From heads/master@v6-16-00-rc1-1275-g029d35d745            |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------

root [0]    TFile* f= new TFile ("simple.root");
root [1]    TTree* t;
root [2]    f-> GetObject ("t",t);
root [3]    TCanvas* c2= new TCanvas ("c2","my histo",500,900);
root [4]    c2-> Divide(1,2);
root [5]