I am running into some strange behavior in version 5.20.00 on my Mac, when I load a library I created called libTFFT.
This library is nothing special except that it links into libfftw.dylib using:
g++ -O2 -dynamiclib -single_module -undefined dynamic_lookup -install_name libTFFT.dylib obj/Darwin/TFFTCorrelation.o -o libTFFT.dylib -L/usr/local/lib -llibfftw
When the library is loaded into root, I get strange behavior with calls to cout or cerr. The extreme example is the following bus error (see output below), even though nothing from this library is called.
If I DO NOT have the “-L/usr/local/lib -llibfftw” in the link command, but instead load this library into root “by hand” with: .L /usr/local/lib/libfftw3.so
(I need to make a link from the libfftw3.dylib to libfftw3.so for this to work)
then I do not get any crashes and all behaves well.
This seems rather strange and appears to be some linking issues inside root.
Anyone have an idea? I would much prefer the libraries to be properly linked with their dependencies.
THANKS.
---------------------------- Output -----------------------------------------
dhcp-062:Root> root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.20/00 24 June 2008 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
ROOT 5.20/00 (trunk@24524, Jun 25 2008, 10:06:00 on macosx)
CINT/ROOT C/C++ Interpreter version 5.16.29, Jan 08, 2008
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
Root Logon from HOME --- Welcome.
Helpers loaded
Local Directory Root Logon.
slib/Darwin/libTFFT.so loaded.
Local Directory Root Logon.
slib/Darwin/libTFFT.so loaded.
root [0] cout << "Hello\n";
Hello
root [1] TFile tmp("Hello.root","RECREATE");
root [2] tmp.ls()
TFile** Hello.root
TFile* Hello.root
root [3] double X[1000],Y[1000];
root [4] for(int i=0;i<1000;i++){ X[i]=(i/100.);Y[i]=sin(X[i]);};
root [5] TGraph *F=new TGraph(1000,X,Y)
root [6] cout << "Hello\n";
Hello
root [7] F->Draw("AL")
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [8] cout << "Hello\n";
Hello
root [9] tmp.ls()
TFile** Hello.root
TFile* Hello.root
root [10] F->Write()
(Int_t)(10856)
root [11] cout << "Hello\n";
Hello
root [12] tmp.ls()
TFile** Hello.root
TFile* Hello.root
*** Break *** bus error
KEY: TGraph Graph;/Users/maurik/Documents/GravWav/Analysis/Root/1853: No such file or directory.
Attaching to process 1853.
Reading symbols for shared libraries . done
Reading symbols for shared libraries ...................................................................................... done
0x91595f69 in wait4 ()
========== STACKS OF ALL THREADS ==========
Thread 1 (process 1853 thread 0x10b):
#0 0x91595f69 in wait4 ()
#1 0x91593abc in system$UNIX2003 ()
#2 0x0086e371 in TUnixSystem::StackTrace ()
#3 0x008716c5 in TUnixSystem::DispatchSignals ()
#4 0x00871838 in SigHandler ()
#5 <signal handler called>
#6 0x022061f9 in std::codecvt<char, char, __mbstate_t>::do_unshift (this=0x22a20a8, __to=0xa03dd500 "?=?", __to_next=@0x20) at ../../../../gcc-4.2.2/libstdc++-v3/src/codecvt.cc:77
#7 0x93663664 in std::ostream::operator<< ()
#8 0x016acca0 in TKey::ls ()
#9 0x0168bd5d in TDirectoryFile::ls ()
#10 0x016912d7 in TFile::ls ()
#11 0x009856b8 in G__G__Base2_10_0_42 ()
#12 0x00f653e2 in Cint::G__ExceptionWrapper ()
#13 0x01030813 in G__execute_call ()
#14 0x0103738d in G__call_cppfunc ()
#15 0x0100bb5e in G__interpret_func ()
#16 0x00ff6f6b in G__getfunction ()
#17 0x011084fb in G__getstructmem ()
#18 0x010fe322 in G__getvariable ()
#19 0x00fc3d31 in G__getitem ()
#20 0x00fc6ca9 in G__getexpr ()
#21 0x01071c21 in G__exec_statement ()
#22 0x00fad9bf in G__exec_tempfile_core ()
#23 0x00fadd67 in G__exec_tempfile_fp ()
#24 0x01079a11 in G__process_cmd ()
#25 0x00859cf4 in TCint::ProcessLine ()
#26 0x007addf7 in TApplication::ProcessLine ()
#27 0x0002fe46 in TRint::HandleTermInput ()
#28 0x0002f4e0 in TTermInputHandler::Notify ()
#29 0x00031444 in TTermInputHandler::ReadNotify ()
#30 0x008719d0 in TUnixSystem::CheckDescriptors ()
#31 0x008720fb in TUnixSystem::DispatchOneEvent ()
#32 0x007fdc80 in TSystem::InnerLoop ()
#33 0x0080041b in TSystem::Run ()
#34 0x007aca43 in TApplication::Run ()
#35 0x0003073e in TRint::Run ()
#36 0x00001bae in main ()