Std::istringstream segmentation fault

Hi everyone,
I am running with root 5.14.00d, and I have a problem using std::istringstream. The code I use is attached. When I run it using those 2 line :

gROOT->ProcessLine(".L Dummy.C+"); Dummy* du = new Dummy("2000 1500 20 5279 50");
I get this output :

root.exe [1] gROOT->ProcessLine(".L Dummy.C+");
Info in TUnixSystem::ACLiC: creating shared library /lhcb/users/poss/work/analyse/DC06/Bu2JPsiK/./Dummy_C.so
root.exe [2] Dummy* du = new Dummy(“2000 1500 20 5279 50”)
p cut 2000

*** Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library “/lib/tls/libthread_db.so.1”.
Attaching to program: /proc/28588/exe, process 28588
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
[Thread debugging using libthread_db enabled]
[New Thread -1208608224 (LWP 28588)]
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.
(no debugging symbols found)…done.

0x009fd7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x076f47e3 in __waitpid_nocancel () from /lib/tls/libc.so.6
#2 0x0769e649 in do_system () from /lib/tls/libc.so.6
#3 0x059d18bd in system () from /lib/tls/libpthread.so.0
#4 0x00394395 in TUnixSystem::Exec () from /cern/root/root_v5.14.00d//lib/libCore.so
#5 0x003947c5 in TUnixSystem::StackTrace () from /cern/root/root_v5.14.00d//lib/libCore.so
#6 0x003928bb in TUnixSystem::DispatchSignals () from /cern/root/root_v5.14.00d//lib/libCore.so
#7 0x003909b3 in SigHandler () from /cern/root/root_v5.14.00d//lib/libCore.so
#8 0x00396ff7 in sighandler () from /cern/root/root_v5.14.00d//lib/libCore.so
#9
#10 0x0031a7ff in std::basic_stringbuf<char, std::char_traits, std::allocator >::~basic_stringbuf ()
from /cern/root/root_v5.14.00d//lib/libCore.so
#11 0x01a548fb in std::basic_istringstream<char, std::char_traits, std::allocator >::~basic_istringstream ()
from /usr/lib/libstdc++.so.6
#12 0x0626da7b in Dummy::Dummy () from /lhcb/users/poss/work/analyse/DC06/Bu2JPsiK/./Dummy_C.so
#13 0x0626e322 in G__file1MF2Xd_2064_0_1 () from /lhcb/users/poss/work/analyse/DC06/Bu2JPsiK/./Dummy_C.so
#14 0x00a4bdba in Cint::G__ExceptionWrapper () from /cern/root/root_v5.14.00d//lib/libCint.so
#15 0x00ae7004 in G__call_cppfunc () from /cern/root/root_v5.14.00d//lib/libCint.so
#16 0x00ad5dd7 in G__interpret_func () from /cern/root/root_v5.14.00d//lib/libCint.so
#17 0x00ac4bc2 in G__getfunction () from /cern/root/root_v5.14.00d//lib/libCint.so
#18 0x00ae5960 in G__new_operator () from /cern/root/root_v5.14.00d//lib/libCint.so
#19 0x00ab206e in G__getexpr () from /cern/root/root_v5.14.00d//lib/libCint.so
#20 0x00aa6f76 in G__define_var () from /cern/root/root_v5.14.00d//lib/libCint.so
#21 0x00b349ca in G__defined_type () from /cern/root/root_v5.14.00d//lib/libCint.so
#22 0x00b044b4 in G__exec_statement () from /cern/root/root_v5.14.00d//lib/libCint.so
#23 0x00aa1972 in G__exec_tempfile_core () from /cern/root/root_v5.14.00d//lib/libCint.so
#24 0x00aa1b64 in G__exec_tempfile_fp () from /cern/root/root_v5.14.00d//lib/libCint.so
#25 0x00b0d656 in G__process_cmd () from /cern/root/root_v5.14.00d//lib/libCint.so
#26 0x00307967 in TCint::ProcessLine () from /cern/root/root_v5.14.00d//lib/libCore.so
#27 0x00242756 in TApplication::ProcessLine () from /cern/root/root_v5.14.00d//lib/libCore.so
#28 0x009dddab in TRint::HandleTermInput () from /cern/root/root_v5.14.00d//lib/libRint.so
#29 0x009dc7a8 in TTermInputHandler::Notify () from /cern/root/root_v5.14.00d//lib/libRint.so
#30 0x009de660 in TTermInputHandler::ReadNotify () from /cern/root/root_v5.14.00d//lib/libRint.so
#31 0x00392cf0 in TUnixSystem::CheckDescriptors () from /cern/root/root_v5.14.00d//lib/libCore.so
#32 0x00391bdc in TUnixSystem::DispatchOneEvent () from /cern/root/root_v5.14.00d//lib/libCore.so
#33 0x002c22cc in TSystem::InnerLoop () from /cern/root/root_v5.14.00d//lib/libCore.so
#34 0x002c2271 in TSystem::Run () from /cern/root/root_v5.14.00d//lib/libCore.so
#35 0x00243236 in TApplication::Run () from /cern/root/root_v5.14.00d//lib/libCore.so
#36 0x009dd83c in TRint::Run () from /cern/root/root_v5.14.00d//lib/libRint.so
#37 0x080488dd in main ()

Can anyone explain to me what I am doing wrong ? When I do the same thing within Cint, it works fine…

Thanks,

Cheers,

S Poss
Dummy.h (667 Bytes)
Dummy.C (1 KB)

Hi,

works for me. Can you remove Dummy_C.so and trying it again? Are you sure ROOT and your system (libc/libstdc++) are compatible?

Cheers, Axel.

Hi,
I did what you said, and it did not change anything. What is strange is that the std::ostringstream works perfectly…

Cheers,

S Poss.

P.S. : Could it be due to the fact that I work with SLC4 ?

Hi,

SLC4 is what I used… Does the same happen if you do .L Dummy.C+ instead of gROOT->ProcessLine(".L Dummy.C+")? Could you also try to run gSystem->CompileMacro(“Dummy.C”, “gk”); instead of gROOT->ProcessLine(".L Dummy.C+")? Can you reproduce it with a stand-alone version of a int main(){new Dummy* du = new Dummy(“2000 1500 20 5279 50”); return 0;} which you compile and link against Dummy.o and then run? Can you post the output of ldd Dummy_C.so and libCore.so?

Cheers, Axel.

.L Dummy.C+ : same as before
gSystem->CompileMacro(“Dummy.C”, “gk”); : idem
For the stand alone part, I don’t know how to do that, I have never used stand alone code.

ouput of ldd Dummy_C.so :
libGX11.so => /cern/root/root_v5.14.00d//lib/libGX11.so (0x00393000)
libGui.so => /cern/root/root_v5.14.00d//lib/libGui.so (0x003dd000)
libGX11TTF.so => /cern/root/root_v5.14.00d//lib/libGX11TTF.so (0x00111000)
libvectorDict.so => /cern/root/root_v5.14.00d//lib/libvectorDict.so (0x00fa7000)
libHtml.so => /cern/root/root_v5.14.00d//lib/libHtml.so (0x00121000)
libMinuit.so => /cern/root/root_v5.14.00d//lib/libMinuit.so (0x00d26000)
libRooFit.so => /cern/root/root_v5.14.00d//lib/libRooFit.so (0x00fc7000)
libCore.so => /cern/root/root_v5.14.00d//lib/libCore.so (0x03ba7000)
libCint.so => /cern/root/root_v5.14.00d//lib/libCint.so (0x0357c000)
libHist.so => /cern/root/root_v5.14.00d//lib/libHist.so (0x00a48000)
libGraf.so => /cern/root/root_v5.14.00d//lib/libGraf.so (0x0016f000)
libGraf3d.so => /cern/root/root_v5.14.00d//lib/libGraf3d.so (0x008f2000)
libGpad.so => /cern/root/root_v5.14.00d//lib/libGpad.so (0x00dd0000)
libTree.so => /cern/root/root_v5.14.00d//lib/libTree.so (0x07d85000)
libMatrix.so => /cern/root/root_v5.14.00d//lib/libMatrix.so (0x02863000)
libRint.so => /cern/root/root_v5.14.00d//lib/libRint.so (0x00358000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00eb2000)
libm.so.6 => /lib/tls/libm.so.6 (0x009d4000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00381000)
libc.so.6 => /lib/tls/libc.so.6 (0x062a7000)
libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x00a15000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x00a24000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x0152c000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x0160b000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00c95000)
libz.so.1 => /usr/lib/libz.so.1 (0x00a32000)
libpcre.so.0 => /lib/libpcre.so.0 (0x00d00000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00d8d000)
/lib/ld-linux.so.2 (0x009fd000)
libdl.so.2 => /lib/libdl.so.2 (0x0038b000)

ouput of ldd libCore.so :
libpcre.so.0 => /lib/libpcre.so.0 (0x008ef000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x008ff000)
libCint.so => /cern/root/root_v5.14.00d//lib/libCint.so (0x00a15000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x0092d000)
libm.so.6 => /lib/tls/libm.so.6 (0x00d84000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x009e6000)
libc.so.6 => /lib/tls/libc.so.6 (0x00da7000)
/lib/ld-linux.so.2 (0x009fd000)

Do you find something suspicious in here ?

Thanks for the help.

Cheers,

S P.

Hi,

[quote=“poss”] libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00eb2000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x0160b000)

ouput of ldd libCore.so :
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x0092d000)

Do you find something suspicious in here ?[/quote]
Yes. ROOT was linked against libstdc++ v5, you are using 6. You have an incompatible compiler. Use a ROOT version that matches your compiler.

Axel.

Thanks for your help. This is still quite strange as it is the only thing that does not work.

But ok, I managed to do what I wanted by other means.

Thanks again.

S. P.