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

**URL:** <https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140>\
**Category:** Newbie\
**Created:** [March 13, 2019, 12:50pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140 "2019-03-13T12:50:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteliosK](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/steliosk/32/19155_2.png) [@SteliosK](https://root-forum.cern.ch/u/SteliosK)\
**Post date:** [March 13, 2019, 12:50pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/1 "2019-03-13T12:50:51Z")

</div>

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

```auto
 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:

```auto
 ***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 lot[simple.root](https://root-forum.cern.ch/uploads/default/original/3X/e/3/e367d61838462e793d844988cca21dcde808e3a8.root) (1.0 MB)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 13, 2019, 1:19pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/2 "2019-03-13T13:19:00Z")

</div>

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

```auto
{
   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);
}

```

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [March 13, 2019, 1:47pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/3 "2019-03-13T13:47:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![SteliosK](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/steliosk/32/19155_2.png) [@SteliosK](https://root-forum.cern.ch/u/SteliosK)\
**Post date:** [March 13, 2019, 4:19pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/4 "2019-03-13T16:19:46Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [March 13, 2019, 5:18pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/5 "2019-03-13T17:18:38Z")

</div>

> [@SteliosK](#):
>
> What do you mean when writing: _two versions installed at the same time_

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?

---

<div class="post-metadata">

**Author:** ![SteliosK](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/steliosk/32/19155_2.png) [@SteliosK](https://root-forum.cern.ch/u/SteliosK)\
**Post date:** [March 13, 2019, 5:55pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/6 "2019-03-13T17:55:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [March 13, 2019, 6:06pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/7 "2019-03-13T18:06:05Z")

</div>

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](https://root.cern.ch/downloading-root).

---

<div class="post-metadata">

**Author:** ![SteliosK](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/steliosk/32/19155_2.png) [@SteliosK](https://root-forum.cern.ch/u/SteliosK)\
**Post date:** [March 14, 2019, 5:43pm UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/8 "2019-03-14T17:43:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 15, 2019, 9:59am UTC](https://root-forum.cern.ch/t/break-segmentation-violation-when-using-divide/33140/9 "2019-03-15T09:59:03Z")

</div>

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

```auto
$ 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] 

```
