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!