Segfault with gcc 4.6.1

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:

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. 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.

See [url]Linking problem to libTree.so

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

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.