# Draw() crash with segmentation violation

**URL:** <https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223>\
**Category:** Newbie\
**Tags:** root\
**Created:** [January 23, 2023, 1:45pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223 "2023-01-23T13:45:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dohyun](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dohyun/32/32214_2.png) [@dohyun](https://root-forum.cern.ch/u/dohyun)\
**Post date:** [January 23, 2023, 1:45pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/1 "2023-01-23T13:45:46Z")

</div>

Hello. I’m learning root program to study high-energy physics.

I used the Draw method to draw graphs. But, it won’t work, and _ **Break** _ Segmentation violation.

* * *

This is the code that called error…

root [0] TF1 f1(“f1”,“sin(x)/x”,0.,10.)  
(TF1 &) Name: f1 Title: sin(x)/x  
root [1] f1.Draw()

* * *

Then, this is the error message.

\*\*\* Break \*\*\* segmentation violation

[/usr/lib/system/libsystem\_platform.dylib] \_sigtramp (no debug info)

[] (no debug info)

[/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO] IIO\_Reader::initImageAtOffset(CGImagePlugin\*, unsigned long, unsigned long, unsigned long) (no debug info)

[/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO] IIOImageSource::makeImagePlus(unsigned long, IIODictionary\*) (no debug info)

[/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO] IIOImageSource::getPropertiesAtIndexInternal(unsigned long, IIODictionary\*) (no debug info)

[/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO] IIOImageSource::copyPropertiesAtIndex(unsigned long, IIODictionary\*) (no debug info)

[/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO] CGImageSourceCopyPropertiesAtIndex (no debug info)

[/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit] ImageSourceOptionsForCGImageSource\_index\_ (no debug info)

[/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit] +[NSBitmapImageRep \_imagesWithData:hfsFileType:extension:zone:expandImageContentNow:includeAllReps:] (no debug info)

[/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit] +[NSBitmapImageRep \_imageRepsWithData:hfsFileType:extension:expandImageContentNow:] (no debug info)

[/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit] +[NSImageRep \_imageRepsWithContentsOfURL:expandImageContentNow:giveUpOnNetworkURLsWithoutGoodExtensions:] (no debug info)

[/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit] -[NSImage initWithContentsOfURL:] (no debug info)

[/usr/local/lib/libGCocoa.so] TGCocoa::SetApplicationIcon() (no debug info)

[/usr/local/lib/libGCocoa.so] TGCocoa::MapWindow(unsigned long) (no debug info)

[/usr/local/lib/libGui.so] TGStatusBar::TGStatusBar(TGWindow const\*, unsigned int, unsigned int, unsigned int, unsigned long) (no debug info)

[/usr/local/lib/libGui.so] TRootCanvas::CreateCanvas(char const\*) (no debug info)

[/usr/local/lib/libGui.so] TRootCanvas::TRootCanvas(TCanvas\*, char const\*, int, int, unsigned int, unsigned int) (no debug info)

[/usr/local/lib/libGui.so] TRootGuiFactory::CreateCanvasImp(TCanvas\*, char const\*, int, int, unsigned int, unsigned int) (no debug info)

[/usr/local/lib/libGpad.so] TCanvas::Constructor(char const\*, char const\*, int) (no debug info)

[/usr/local/lib/libGpad.so] TCanvas::TCanvas(char const\*, char const\*, int) (no debug info)

[/usr/local/lib/libGpad.so] TCanvas::MakeDefCanvas() (no debug info)

[] (no debug info)

[/usr/local/lib/libCling.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value\*) const (no debug info)

[/usr/local/lib/libCling.so] cling::Interpreter::RunFunction(clang::FunctionDecl const\*, cling::Value\*) (no debug info)  
[/usr/local/lib/libCling.so] cling::Interpreter::EvaluateInternal(std::\_\_1::basic\_string\<char, std::\_\_1::char\_traits, std::\_\_1::allocator \> const&, cling::CompilationOptions, cling::Value\*, cling::Transaction\*\*, unsigned long) (no debug info)  
[/usr/local/lib/libCling.so] cling::Interpreter::process(std::\_\_1::basic\_string\<char, std::\_\_1::char\_traits, std::\_\_1::allocator \> const&, cling::Value\*, cling::Transaction\*\*, bool) (no debug info)  
[/usr/local/lib/libCling.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value\*, bool) (no debug info)  
[/usr/local/lib/libCling.so] HandleInterpreterException(cling::MetaProcessor\*, char const\*, cling::Interpreter::CompilationResult&, cling::Value\*) (no debug info)  
[/usr/local/lib/libCling.so] TCling::ProcessLine(char const\*, TInterpreter::EErrorCode\*) (no debug info)  
[/usr/local/lib/libCore.so] TROOT::ProcessLine(char const\*, int\*) (no debug info)  
[/usr/local/lib/libCore.so] TObject::AppendPad(char const\*) (no debug info)  
[/usr/local/lib/libHist.so] TF1::Draw(char const\*) (no debug info)  
[/usr/local/lib/libCling.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value\*) const (no debug info)  
[/usr/local/lib/libCling.so] cling::Interpreter::RunFunction(clang::FunctionDecl const\*, cling::Value\*) (no debug info)  
[/usr/local/lib/libCling.so] cling::Interpreter::EvaluateInternal(std::\_\_1::basic\_string\<char, std::\_\_1::char\_traits, std::\_\_1::allocator \> const&, cling::CompilationOptions, cling::Value\*, cling::Transaction\*\*, unsigned long) (no debug info)  
[/usr/local/lib/libCling.so] cling::Interpreter::process(std::\_\_1::basic\_string\<char, std::\_\_1::char\_traits, std::\_\_1::allocator \> const&, cling::Value\*, cling::Transaction\*\*, bool) (no debug info)  
[/usr/local/lib/libCling.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value\*, bool) (no debug info)  
[/usr/local/lib/libCling.so] HandleInterpreterException(cling::MetaProcessor\*, char const\*, cling::Interpreter::CompilationResult&, cling::Value\*) (no debug info)  
[/usr/local/lib/libCling.so] TCling::ProcessLine(char const\*, TInterpreter::EErrorCode\*) (no debug info)  
[/usr/local/lib/libRint.so] TRint::ProcessLineNr(char const\*, char const\*, int\*) (no debug info)  
[/usr/local/lib/libRint.so] TRint::HandleTermInput() (no debug info)  
[/usr/local/lib/libCore.so] TUnixSystem::CheckDescriptors() (no debug info)  
[/usr/local/lib/libCore.so] TMacOSXSystem::DispatchOneEvent(bool) (no debug info)  
[/usr/local/lib/libCore.so] TSystem::InnerLoop() (no debug info)  
[/usr/local/lib/libCore.so] TSystem::Run() (no debug info)  
[/usr/local/lib/libCore.so] TApplication::Run(bool) (no debug info)  
[/usr/local/lib/libRint.so] TRint::Run(bool) (no debug info)  
[/usr/local/bin/root.exe] main (no debug info)  
[/usr/lib/dyld] start (no debug info)

* * *

I’m using M1 macbook pro and its version is ventura 13.2 .  
My root version is 6.26.10. I installed it using “brew install root” .  
I run root in the terminal, and other functions work well except draw() (+ other graphical function do not work) .

When I run draw() method, an root.exe file is created in the dock and the error message as above is printed.

Please Help me!

* * *

---

<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:** [January 23, 2023, 1:47pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/2 "2023-01-23T13:47:17Z")

</div>

`TF1 f1("f1", "sin(x)/x", 1.e-11, 10.);`

---

<div class="post-metadata">

**Author:** ![dohyun](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dohyun/32/32214_2.png) [@dohyun](https://root-forum.cern.ch/u/dohyun)\
**Post date:** [January 23, 2023, 2:08pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/3 "2023-01-23T14:08:47Z")

</div>

Thank you for your reply.  
But, the same error still occurs.

I don’t think it’s a matter of code. I think there’s a problem with the way the Draw() method approaches the inside of the computer, is there any way to infer this from the error message?

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [January 23, 2023, 2:24pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/4 "2023-01-23T14:24:44Z")

</div>

@couet Can you reproduce that on the same macOS version? :-/

---

<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:** [January 23, 2023, 2:28pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/5 "2023-01-23T14:28:25Z")

</div>

no:

 ![Screenshot 2023-01-23 at 15.28.28](https://root-forum.cern.ch/uploads/default/original/3X/e/e/ee9355ec9f3168f3a02a028937a1bf1e6aa6ad2a.jpeg)

---

<div class="post-metadata">

**Author:** ![dohyun](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dohyun/32/32214_2.png) [@dohyun](https://root-forum.cern.ch/u/dohyun)\
**Post date:** [January 23, 2023, 3:24pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/6 "2023-01-23T15:24:01Z")

</div>

Thank you for your reply!

May be “segmentation violation” problem caused by my computer…  
Is there any way to find sloution from the error message? eg. modifying something in the paths that’s written message…

---

<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:** [January 23, 2023, 3:26pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/7 "2023-01-23T15:26:40Z")

</div>

Can you try a simple thing like:

```auto
auto c = new TCanvas();

```

?  
It should open a graphics window.

---

<div class="post-metadata">

**Author:** ![dohyun](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dohyun/32/32214_2.png) [@dohyun](https://root-forum.cern.ch/u/dohyun)\
**Post date:** [January 23, 2023, 3:29pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/8 "2023-01-23T15:29:57Z")

</div>

Wow! It works well!

 ![스크린샷 2023-01-24 00.29.11](https://root-forum.cern.ch/uploads/default/original/3X/7/b/7b4cfd5c1b3ec2cf46c58c520d0b391cd7d454be.jpeg)

---

<div class="post-metadata">

**Author:** ![dohyun](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dohyun/32/32214_2.png) [@dohyun](https://root-forum.cern.ch/u/dohyun)\
**Post date:** [January 23, 2023, 3:33pm UTC](https://root-forum.cern.ch/t/draw-crash-with-segmentation-violation/53223/9 "2023-01-23T15:33:04Z")

</div>

Oh, my problem has been solved!

I removed python virtual enviroment and Draw() method worked very well!!!  
Thank you so much for your care!!!
