# Segfault with gcc 4.6.1

**URL:** <https://root-forum.cern.ch/t/segfault-with-gcc-4-6-1/13863>\
**Category:** ROOT\
**Created:** [February 25, 2012, 8:03pm UTC](https://root-forum.cern.ch/t/segfault-with-gcc-4-6-1/13863 "2012-02-25T20:03:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jod](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/dbc845/32.png) [@jod](https://root-forum.cern.ch/u/jod)\
**Post date:** [February 25, 2012, 8:03pm UTC](https://root-forum.cern.ch/t/segfault-with-gcc-4-6-1/13863/1 "2012-02-25T20:03:25Z")

</div>

I’ve just moved to Xubuntu 11.10 from Mint 11, so have changed gcc version to 4.6.1. I successfully built root, and my application compiles without errors using:

```auto

```

However when I actually RUN the application it segfaults with the following output:

[code]$ plotter merge.root  
Warning in TClass::TClass: no dictionary for class TTree is available  
Warning in TClass::TClass: no dictionary for class TBranch is available  
Warning in TClass::TClass: no dictionary for class TBranchObject is available  
Warning in TClass::TClass: no dictionary for class TBranchElement is available  
Warning in TClass::TClass: no dictionary for class TLeaf is available  
Warning in TClass::TClass: no dictionary for class TLeafS is available  
Warning in TClass::TClass: no dictionary for class TLeafI is available  
Warning in TClass::TClass: no dictionary for class TLeafF is available  
Warning in TClass::TClass: no dictionary for class TLeafD is available  
Warning in TClass::TClass: no dictionary for class TLeafB is available  
Warning in TClass::TClass: no dictionary for class TLeafC is available  
Warning in TClass::TClass: no dictionary for class TLeafObject is available  
Warning in TClass::TClass: no dictionary for class TLeafElement is available  
Warning in TClass::TClass: no dictionary for class TVirtualIndex is available  
Warning in TClass::TClass: no dictionary for class TBranchRef is available

Using input file: merge.root  
Creating output file: plots.root  
Error in TBufferFile::ReadClassBuffer: class: TNamed, attempting to access a wrong version: 16, object skipped at offset 56  
Error in TBufferFile::CheckByteCount: object of class TNamed read too few bytes: 2 instead of 117355  
Tree has 53 entries.

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

# =========================================================== There was a crash. This is the entire stack trace of all threads:

# #0 0x00007fee60cc311e in waitpid () from /lib/x86\_64-linux-gnu/libc.so.6 #1 0x00007fee60c59e0e in ?? () from /lib/x86\_64-linux-gnu/libc.so.6 #2 0x00007fee624291b7 in TUnixSystem::StackTrace() () from /software/ROOT/root\_v5.32.00/lib/libCore.so #3 0x00007fee6242ba83 in TUnixSystem::DispatchSignals(ESignals) () from /software/ROOT/root\_v5.32.00/lib/libCore.so #4 #5 0x0000000000000000 in ?? () #6 0x00000000004025e0 in main (argc=2, argv=0x7fff37e536a8) at plotter.cpp:70

# The lines below might hint at the cause of the crash. If they do not help you then please submit a bug report at [http://root.cern.ch/bugs](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.

# #5 0x0000000000000000 in ?? () #6 0x00000000004025e0 in main (argc=2, argv=0x7fff37e536a8) at plotter.cpp:70

[/code]

I believe there have been changes to how the linker works in gcc 4.6, I had some issues compiling a Geant4 application because of this, and had to specify a few libraries to link against that previously weren’t needed.  
Could similar issues cause such a crash at runtime? The code works fine on older Linux machines.

---

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [February 25, 2012, 9:32pm UTC](https://root-forum.cern.ch/t/segfault-with-gcc-4-6-1/13863/2 "2012-02-25T21:32:20Z")

</div>

See [url][Linking problem to libTree.so](https://root-forum.cern.ch/t/linking-problem-to-libtree-so/13697/1)

---

<div class="post-metadata">

**Author:** ![jod](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/dbc845/32.png) [@jod](https://root-forum.cern.ch/u/jod)\
**Post date:** [February 26, 2012, 1:13pm UTC](https://root-forum.cern.ch/t/segfault-with-gcc-4-6-1/13863/3 "2012-02-26T13:13:04Z")

</div>

Adding “-Wl,–no-as-needed” fixed the problem. Thanks!

---

<div class="post-metadata">

**Author:** ![RaubkatzHimself](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/r/0ea827/32.png) [@RaubkatzHimself](https://root-forum.cern.ch/u/RaubkatzHimself)\
**Post date:** [December 13, 2017, 9:19am UTC](https://root-forum.cern.ch/t/segfault-with-gcc-4-6-1/13863/4 "2017-12-13T09:19:22Z")

</div>

Hy, where did you add this flag??  
I’m really new to root, and I came across the same problem.  
So, my question is: Do I have to add it in the main file or when compiling?? I really don’t know.
