Confusion Regarding Loading Shared Libraries

Dear all,

I was attempting to run sample builds of the CutLang Interpreter. The interpreter relies heavily on ROOT. The example build I tried to run compiled successfully. When I tried to run and display the output in a PDF however, it returned the following error:-

Command:
./showall.sh 1 histoOut-ex8.root

Output:


Processing showall.C(1 , "histoOut-ex8.root")...
IncrementalExecutor::executeFunction: symbol '_ZN4TH1FC1ERKS_' unresolved while linking [cling interface function]!
You are probably missing the definition of TH1F::TH1F(TH1F const&)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN7TCanvasC1EPKcS1_iiii' unresolved while linking [cling interface function]!
You are probably missing the definition of TCanvas::TCanvas(char const*, char const*, int, int, int, int)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN7TLegendC1EddddPKcS1_' unresolved while linking [cling interface function]!
You are probably missing the definition of TLegend::TLegend(double, double, double, double, char const*, char const*)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol '_ZN7TLegend8AddEntryEPK7TObjectPKcS4_' unresolved while linking [cling interface function]!
You are probably missing the definition of TLegend::AddEntry(TObject const*, char const*, char const*)
Maybe you need to load the corresponding shared library?

I have no idea how to work this out. After looking through their documentation (https://root.cern.ch/interacting-shared-libraries-rootcling) I managed to find the corresponding header files (TH1F.h, TCanvas.h, TLegend.h). I successfully ran .L Header.h+ and generated the dictionaries. (.so file extension)

I did not know how to proceed from there and executed the code with no effect. I also ran and compiled rootcling -f DictOutput.cxx -c OPTIONS Header1.h Header2.h ... Linkdef.h but the result was the same. In both cases the output was the same as the prior

The issue is restricted to ROOT and loading the libraries only, as running the same code on Binder (https://mybinder.org/v2/gh/unelg/CutLang/master?urlpath=/lab/tree/binder%2Fexample1.ipynb) returned the correct output. Binder creates a virtual environment and had inexplicably loaded the required shared libraries.

Kindly help me fix this. Thanks in advance!

ROOT Version: 6.19/01
Platform: Ubuntu 19.10

1 Like

Hello,

it’s hard to see what your scripts are doing. From the error message, it seems that loading libraries is required, not header files as you did with .L ??.h.

  • What are the commands being run inside the scripts?
  • How did you get your root version? (Compiled manually, set up by someone, downloaded binaries, etc?)

Hey,

Yes, loading libraries is a requirement. I needed the header files to generate the dictionary (.so) files. I am unsure as to how to go about loading the created dictionaries.

I manually compiled root using cmake. All the commands I executed to build root were taken from ROOT’s documentation.

The showall.sh script primarily makes tiny modifications and proceeds to call a function showall(), which further calls showall.C, the file of which is attached below.

showall.C (5.9 KB)

Here is the showAll function invoked by the script:

showAll() { 
        cat ${htxtfile} | cut -f2 -d'"' | cut -f1 -d','  | grep -v Basics > histoname.txt
        root.exe -l -q -x showall.C"(${regno} , \"${rootfile}\")"
        exit 0
}

Thanking you for your time and assistance.

Regards,

1 Like
Processing showall.C(1 , "histoOut-ex8.root")... IncrementalExecutor::executeFunction: symbol '_ZN4TH1FC1ERKS_' unresolved while linking [cling interface function]! You are probably missing the definition of TH1F::TH1F(TH1F const&)

This is quite strange. 'TH1F’s copy constructor is part of the libHist.so library that is always automatically loaded. For example you can do:

root.exe -b -l
root [] TH1F h;

You can see the libraries that have been loaded via

root [8] gInterpreter->GetSharedLibs()
(const char *) "/opt/build/root_builds/master.debug/lib/libRint.so /opt/build/root_builds/master.debug/lib/libCore.so /usr/lib/libz.1.dylib /usr/lib/libsqlite3.dylib /usr/lib/libxml2.2.dylib /usr/lib/libnetwork.dylib /usr/lib/libapple_nghttp2.dylib /usr/lib/libenergytrace.dylib /usr/lib/libpcap.A.dylib /usr/lib/libcoretls.dylib /usr/lib/libcoretls_cfhelpers.dylib /usr/lib/libxar.1.dylib /usr/lib/libarchive.2.dylib /usr/lib/libbz2.1.0.dylib /usr/lib/liblzma.5.dylib /usr/lib/libmecabra.dylib /usr/lib/libcompression.dylib /usr/lib/libMobileGestalt.dylib /usr/lib/libFosl_dynamic.dylib /usr/lib/libiconv.2.dylib /usr/lib/libheimdal-asn1.dylib /usr/lib/libutil.dylib /usr/lib/libcharset.1.dylib /usr/lib/libmecab.1.0.0.dylib /usr/lib/libgermantok.dylib /usr/lib/libThaiTokenizer.dylib /usr/lib/libChineseTokenizer.dylib /usr/lib/libcmph.dylib /usr/lib/libxslt.1.dylib /usr/lib/libate.dylib /opt/build/root_builds/master.debug/lib/libRIO.so /opt/build/root_builds/master.debug/lib/libThread.so /opt/build/root_builds/master.debug/lib/libCling.so /usr/lib/libncurses.5.4.dylib /opt/build/root_builds/master.debug/lib/libMathCore.so /opt/build/root_builds/master.debug/lib/libImt.so /opt/build/root_builds/master.debug/lib/libtbb.dylib /opt/build/root_builds/master.debug/lib/libHist.so /opt/build/root_builds/master.debug/lib/libMatrix.so"

I wonder if the problem is not one of ‘mixed’ environment where somehow PATH and LD_LIBRARY_PATH do not agree on which version/build of ROOT to use.