Pcm files in PROOF compiled code

Hello experts,
I have a project that uses dictionary generation, and library linking to get PROOF launched inside a compiled executable. It worked on a root-v5.34.25 with gcc 4.8, but no longer works on root 6.12.04 with g++ 7.2.0, on a ubuntu 17.10 machine.

I understand that root 6 uses primarily cling, not cint, so need some guidance on updating my code.

I hope you can ignore the redundancies in my make command…they come from a makefile that has

ROOTCFLAGS  :=$(shell $(ROOTSYS)/bin/root-config --cflags)
ROOTLIBS    :=$(shell $(ROOTSYS)/bin/root-config --libs)
CXXFLAGS   = $(ROOTCFLAGS) -fPIC -O2
LIBS    := $(ROOTLIBS) -lm -lz -lutil -lnsl -lpthread

this semi-automated method carries some baggage…

First I compile the .o file for my class, radAnalyzerClass.cxx
g++ -pthread -std=c++1y -m64 -I/usr/local/root-6.12.04-gcc-7.2.0-build/include -fPIC -O2 -L/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lm -ldl -rdynamic -lSpectrum -lMinuit -lMinuit2 -lTMVA -lMLP -lMathCore -lMathMore -lFumili -Wl,-rpath,/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lTreePlayer -lFoam -lProof -lProofPlayer -c radAnalyzerClass.cxx

Then I generate the dictionary
rootcint -f radAnalyzerClassDict.cxx -c radAnalyzerClass.h radAnalyzerLinkDef.h
this also generates a .pcm file, which it did not in the past.

Then I create a .o file from the dictionary
g++ -pthread -std=c++1y -m64 -I/usr/local/root-6.12.04-gcc-7.2.0-build/include -fPIC -O2 -L/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lm -ldl -rdynamic -lSpectrum -lMinuit -lMinuit2 -lTMVA -lMLP -lMathCore -lMathMore -lFumili -Wl,-rpath,/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lTreePlayer -lFoam -lProof -lProofPlayer -c radAnalyzerClassDict.cxx

Then I create a .so file from the .o files
g++ -pthread -std=c++1y -m64 -I/usr/local/root-6.12.04-gcc-7.2.0-build/include -fPIC -O2 -shared -o radAnalyzerClass.so radAnalyzerClass.o radAnalyzerClassDict.o -L/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -Wl,-rpath,/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lm -ldl -rdynamic -lSpectrum -lMinuit -lMinuit2 -lTMVA -lMLP -lMathMore -lFumili -lFoam -lProof -lProofPlayer -lm -lz -lutil -lnsl -lpthread -L. -L/home/main/working/radAnalyzer_template -Wl,-R/home/main/working/radAnalyzer_template

Then I link the .so file to the executable when compiling:

g++  -pthread -std=c++1y -m64 -I/usr/local/root-6.12.04-gcc-7.2.0-build/include -fPIC -O2 -o radAnalyzer.x 
radAnalyzer.cpp radAnalyzerClass.o radAnalyzerClassDict.o 
/home/main/working/radAnalyzer_template/radAnalyzerClass.so \
-L/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree 
-lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc 
-pthread -Wl,-rpath,/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lm -ldl -rdynamic 
 -lSpectrum -lMinuit -lMinuit2 -lTMVA -lMLP -lTreePlayer -lMathCore -lMathMore -lFumili
 -Wl,-rpath,/usr/local/root-6.12.04-gcc-7.2.0-build/lib -lTreePlayer -lFoam 
 -lProof -lProofPlayer -lm -lz -lutil -lnsl -lpthread  
-L. -L/home/main/working/radAnalyzer_template -Wl,-R/home/main/working/radAnalyzer_template -lquadmath -Wno-deprecated

Anyway, everything compiles just fine with no errors. But when I run the executable I get a hideous error

Error in <TUnixSystem::FindDynamicLibrary>: /home/main/working/radAnalyzer_template/radAnalyzerClass_rdict.pcm[.so | .dll | .dylib | .sl | .dl | .a] does not exist in /usr/local/root-6.12.04-gcc-7.2.0-build/lib:.:/usr/local/root-6.12.04-gcc-7.2.0-build/lib:/lib/x86_64-linux-gnu/tls/haswell/x86_64:/lib/x86_64-linux-gnu/tls/haswell:/lib/x86_64-linux-gnu/tls/x86_64:/lib/x86_64-linux-gnu/tls:/lib/x86_64-linux-gnu/haswell/x86_64:/lib/x86_64-linux-gnu/haswell:/lib/x86_64-linux-gnu/x86_64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/tls/haswell/x86_64:/usr/lib/x86_64-linux-gnu/tls/haswell:/usr/lib/x86_64-linux-gnu/tls/x86_64:/usr/lib/x86_64-linux-gnu/tls:/usr/lib/x86_64-linux-gnu/haswell/x86_64:/usr/lib/x86_64-linux-gnu/haswell:/usr/lib/x86_64-linux-gnu/x86_64:/usr/lib/x86_64-linux-gnu:/lib/tls/haswell/x86_64:/lib/tls/haswell:/lib/tls/x86_64:/lib/tls:/lib/haswell/x86_64:/lib/haswell:/lib/x86_64:/lib:/usr/lib/tls/haswell/x86_64:/usr/lib/tls/haswell:/usr/lib/tls/x86_64:/usr/lib/tls:/usr/lib/haswell/x86_64:/usr/lib/haswell:/usr/lib/x86_64:/usr/lib:/home/main/working/radAnalyzer_template/
Warning in <TProofLite::GetNumberOfWorkers>: number of workers specified by 'workers=' is non-positive: using default
Warning in <TProofLite::GetNumberOfWorkers>: number of workers specified by 'workers=' is non-positive: using default
 +++ Starting PROOF-Lite with 8 workers +++
Opening connections to workers: OK (8 workers)                 
Setting up worker servers: OK (8 workers)                 
PROOF set to parallel mode (8 workers)
22:23:09 27219 Wrk-0.0 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
22:23:09 27259 Wrk-0.5 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
22:23:09 27242 Wrk-0.3 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
22:23:09 27236 Wrk-0.1 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
22:23:09 27250 Wrk-0.4 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
22:23:09 27276 Wrk-0.6 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
22:23:09 27287 Wrk-0.7 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
22:23:09 27239 Wrk-0.2 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
Error in <TProofLite::CopyMacroToCache>: file /home/main/working/radAnalyzer_template/radAnalyzerClass_rdict.pcm not found or not readable
***class instance created*** 
 
Info in <TProofLite::SetQueryRunning>: starting query: 1
Info in <TProofQueryResult::SetRunning>: nwrks: 8

 *** Break *** segmentation violation

I can show the rest of the segfault if needed…

I was familiar with how to integrate my own classes into root 5, but I’m lost here. The .pcm files are new to me and I don’t understand their purpose. Perhaps I am missing something obvious?

If there is nothing obvious, then I will strip my code down to produce minimal working files that reproduce the bug…

Many many thanks!

I found some helpful resources to making dictionaries with cling which suggest a few changes to my method.

Let me try to solve this myself for a bit. Sorry to post prematurely. But I don’t know if I will succeed anyway with the new info…:slight_smile:

Dear mgv4ce,

Ok, let us know if you need any help.
Since you are on 6.12 and using PROOF-Lite, you may be interested in trying TProcessExecutor and alike. Have a loot at the ‘mp*.C’ tutorials under ‘tutorials/multicore’ .

G Ganis

Dear Ganis,

Thanks for the references! It seems that the methods involved there are pushing the boundaries of my cpp. I will try to get better to understand all the new features. But for the moment the tutorials don’t help much.

I have experimented with the changes that I could see w.r.t. using cling instead of cint. But I still get the same problem. So I reduce it to a minimal working example.

I attach files that should reproduce the issue. There are only two places that the CINT vs CLING reference comes up–in the makefile when generating the dictionaries; and in the LinkDef file. In both files if you comment in the CINT section and use root 5.34.25 with gcc 4.8 the code will compile and run without segfault. But if you comment in the CLING options, and use root 6.12 with gcc 7.2 then the code compiles but segfaults at runtime.

Here is the segfault:

 +++ Starting PROOF-Lite with 8 workers +++
Opening connections to workers: OK (8 workers)                 
Setting up worker servers: OK (8 workers)                 
PROOF set to parallel mode (8 workers)
10:46:40 27333 Wrk-0.0 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
10:46:40 27335 Wrk-0.1 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
10:46:40 27347 Wrk-0.4 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
10:46:40 27337 Wrk-0.2 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
10:46:40 27340 Wrk-0.3 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
10:46:40 27366 Wrk-0.6 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
10:46:40 27375 Wrk-0.7 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
10:46:40 27355 Wrk-0.5 | Info in <TProofServLite::HandleCache>: loading macro radAnalyzerClass.so ...
***class instance created*** 
 
Info in <TProofLite::SetQueryRunning>: starting query: 1
Info in <TProofQueryResult::SetRunning>: nwrks: 8

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007fc4cd5058fa in __GI___waitpid (pid=27582, stat_loc=stat_loc
entry=0x7fffc2294668, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00007fc4cd4749cb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007fc4cf2510f7 in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x56159708b7c0) at /usr/local/root-6.12.04-gcc-7.2.0/core/unix/src/TUnixSystem.cxx:2118
#3  TUnixSystem::StackTrace (this=0x56159708b7c0) at /usr/local/root-6.12.04-gcc-7.2.0/core/unix/src/TUnixSystem.cxx:2412
#4  0x00007fc4cf25385c in TUnixSystem::DispatchSignals (this=0x56159708b7c0, sig=kSigSegmentationViolation) at /usr/local/root-6.12.04-gcc-7.2.0/core/unix/src/TUnixSystem.cxx:3643
#5  <signal handler called>
#6  TGCompositeFrame::TGCompositeFrame (this=this
entry=0x561599ab88e0, p=p
entry=0x0, w=w
entry=10, h=h
entry=10, options=options
entry=2051, back=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0/gui/gui/src/TGFrame.cxx:850
#7  0x00007fc4beb58d6d in TGMainFrame::TGMainFrame (this=this
entry=0x561599ab88e0, p=0x0, w=10, h=10, options=2050) at /usr/local/root-6.12.04-gcc-7.2.0/gui/gui/src/TGFrame.cxx:1427
#8  0x00007fc4beb59af0 in TGTransientFrame::TGTransientFrame (this=0x561599ab88e0, p=<optimized out>, main=0x0, w=<optimized out>, h=<optimized out>, options=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0/gui/gui/src/TGFrame.cxx:1895
#9  0x00007fc4bef75650 in TProofProgressDialog::TProofProgressDialog (this=0x56159988c9e0, proof=0x561598c8d9c0, selector=0x7fffc22977b9 "", files=<optimized out>, first=<optimized out>, entries=10000000000) at /usr/local/root-6.12.04-gcc-7.2.0/gui/sessionviewer/src/TProofProgressDialog.cxx:114
#10 0x00007fc4cf78908a in ?? ()
#11 0x00007fffc22972c0 in ?? ()
#12 0x00007fffc2297300 in ?? ()
#13 0x00007fffc2297400 in ?? ()
#14 0x000056159988c9e0 in ?? ()
#15 0x00000002540be400 in ?? ()
#16 0x000056159988c9e0 in ?? ()
#17 0x00007fffc2297400 in ?? ()
#18 0x00007fc4c7a845fe in (anonymous namespace)::sv_to<long long> (val=...) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:134
#19 0x00007fc4c7a84e6c in TClingCallFunc::exec (this=this
entry=0x5615996bb0f0, address=address
entry=0x0, ret=ret
entry=0x7fffc22975e0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:1773
#20 0x00007fc4c7a857e5 in TClingCallFunc::exec_with_valref_return (this=this
entry=0x5615996bb0f0, address=address
entry=0x0, ret=ret
entry=0x7fffc22975e0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:1826
#21 0x00007fc4c7a8efeb in TClingCallFunc::ExecT<long> (address=0x0, this=0x5615996bb0f0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:2063
#22 TClingCallFunc::ExecInt (this=0x5615996bb0f0, address=0x0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:2076
#23 0x00007fc4cf22213d in TMethodCall::Execute (this=0x5615998dede0, object=<optimized out>, retLong=
0x7fffc2297728: 140483271259264) at /usr/local/root-6.12.04-gcc-7.2.0/core/meta/src/TMethodCall.cxx:457
#24 0x00007fc4cde9a190 in TMethodCall::Execute (retLong=
0x7fffc2297728: 140483271259264, this=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0-build/include/TMethodCall.h:136
#25 TPluginHandler::ExecPluginImpl<TProofLite*, char const*, int, long long, long long> (this=0x5615996b94b0) at /usr/local/root-6.12.04-gcc-7.2.0-build/include/TPluginManager.h:162
#26 TPluginHandler::ExecPlugin<TProofLite*, char const*, int, long long, long long> (nargs=5, this=0x5615996b94b0) at /usr/local/root-6.12.04-gcc-7.2.0-build/include/TPluginManager.h:174
#27 TProofLite::Process (this=0x561598c8d9c0, dset=0x561599802fa0, selector=0x0, option=<optimized out>, nentries=10000000000, first=0) at /usr/local/root-6.12.04-gcc-7.2.0/proof/proof/src/TProofLite.cxx:1231
#28 0x00007fc4cde492a4 in TProof::Process (this=0x561598c8d9c0, dset=<optimized out>, selector=<optimized out>, option=<optimized out>, nentries=<optimized out>, first=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0/proof/proof/src/TProof.cxx:5746
#29 0x0000561596951bd1 in main ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum.
Only if you are really convinced it is a bug in ROOT then please submit a
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.
===========================================================
#6  TGCompositeFrame::TGCompositeFrame (this=this
entry=0x561599ab88e0, p=p
entry=0x0, w=w
entry=10, h=h
entry=10, options=options
entry=2051, back=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0/gui/gui/src/TGFrame.cxx:850
#7  0x00007fc4beb58d6d in TGMainFrame::TGMainFrame (this=this
entry=0x561599ab88e0, p=0x0, w=10, h=10, options=2050) at /usr/local/root-6.12.04-gcc-7.2.0/gui/gui/src/TGFrame.cxx:1427
#8  0x00007fc4beb59af0 in TGTransientFrame::TGTransientFrame (this=0x561599ab88e0, p=<optimized out>, main=0x0, w=<optimized out>, h=<optimized out>, options=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0/gui/gui/src/TGFrame.cxx:1895
#9  0x00007fc4bef75650 in TProofProgressDialog::TProofProgressDialog (this=0x56159988c9e0, proof=0x561598c8d9c0, selector=0x7fffc22977b9 "", files=<optimized out>, first=<optimized out>, entries=10000000000) at /usr/local/root-6.12.04-gcc-7.2.0/gui/sessionviewer/src/TProofProgressDialog.cxx:114
#10 0x00007fc4cf78908a in ?? ()
#11 0x00007fffc22972c0 in ?? ()
#12 0x00007fffc2297300 in ?? ()
#13 0x00007fffc2297400 in ?? ()
#14 0x000056159988c9e0 in ?? ()
#15 0x00000002540be400 in ?? ()
#16 0x000056159988c9e0 in ?? ()
#17 0x00007fffc2297400 in ?? ()
#18 0x00007fc4c7a845fe in (anonymous namespace)::sv_to<long long> (val=...) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:134
#19 0x00007fc4c7a84e6c in TClingCallFunc::exec (this=this
entry=0x5615996bb0f0, address=address
entry=0x0, ret=ret
entry=0x7fffc22975e0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:1773
#20 0x00007fc4c7a857e5 in TClingCallFunc::exec_with_valref_return (this=this
entry=0x5615996bb0f0, address=address
entry=0x0, ret=ret
entry=0x7fffc22975e0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:1826
#21 0x00007fc4c7a8efeb in TClingCallFunc::ExecT<long> (address=0x0, this=0x5615996bb0f0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:2063
#22 TClingCallFunc::ExecInt (this=0x5615996bb0f0, address=0x0) at /usr/local/root-6.12.04-gcc-7.2.0/core/metacling/src/TClingCallFunc.cxx:2076
#23 0x00007fc4cf22213d in TMethodCall::Execute (this=0x5615998dede0, object=<optimized out>, retLong=
0x7fffc2297728: 140483271259264) at /usr/local/root-6.12.04-gcc-7.2.0/core/meta/src/TMethodCall.cxx:457
#24 0x00007fc4cde9a190 in TMethodCall::Execute (retLong=
0x7fffc2297728: 140483271259264, this=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0-build/include/TMethodCall.h:136
#25 TPluginHandler::ExecPluginImpl<TProofLite*, char const*, int, long long, long long> (this=0x5615996b94b0) at /usr/local/root-6.12.04-gcc-7.2.0-build/include/TPluginManager.h:162
#26 TPluginHandler::ExecPlugin<TProofLite*, char const*, int, long long, long long> (nargs=5, this=0x5615996b94b0) at /usr/local/root-6.12.04-gcc-7.2.0-build/include/TPluginManager.h:174
#27 TProofLite::Process (this=0x561598c8d9c0, dset=0x561599802fa0, selector=0x0, option=<optimized out>, nentries=10000000000, first=0) at /usr/local/root-6.12.04-gcc-7.2.0/proof/proof/src/TProofLite.cxx:1231
#28 0x00007fc4cde492a4 in TProof::Process (this=0x561598c8d9c0, dset=<optimized out>, selector=<optimized out>, option=<optimized out>, nentries=<optimized out>, first=<optimized out>) at /usr/local/root-6.12.04-gcc-7.2.0/proof/proof/src/TProof.cxx:5746
#29 0x0000561596951bd1 in main ()
===========================================================

constants.h (244 Bytes)
headers.h (1.1 KB)
radAnalyzer.cpp (1.9 KB)
radAnalyzerClass.h (1.9 KB)
radAnalyzerClass.cxx (5.8 KB)
radAnalyzerLinkDef.h (186 Bytes)
makefile.txt (2.1 KB)

Many thanks for the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.