Generating rootmap files with root 6.04.18

Dear Rooters,

we are trying to adapt our Marabou project to Root 6.
Compiling, linking and running of the execs with gcc 4.8,
all is fine.
Our issue at the moment is with loading our shared libs in a root session.
Under Root 5 we generated rootmap files with $ROOTSYS/bin/rlibmap
getting files like:

Library.TMbsWindow2d:           libTMrbUtils.so libGraf.so
Library.TMbsWindowF:            libTMrbUtils.so libGraf.so
...

With this the following works:

gSystem->Load("libTMrbUtils.so");

Btw. This file generated under Root 5 still does its job under Root 6,
though rlibmap is no longer there.

Under Root 6 I tried to generate dictionary, pcm and rootmap
as done in $ROOTSYS/hist/hist/Module.mk
The resulting command line looks like this:

rootcling -rootbuild -f utils/src/G__TMrbUtilsDict.cxx
-s  lib/libTMrbUtils.so -rml libTMrbUtils.so 
-rmf lib/libTMrbUtils.rootmap 
-m /software/opt/trusty/x86_64/root/6.04.18/lib/libGraf_rdict.pcm
-c -writeEmptyRootPCM
utils/inc/GlobDef.h utils/inc/SetColor.h utils/inc/ utils/inc/TMrbEnv.h 
...
utils/inc/TMrbWdw.h utils/inc/LinkDef.h

The resulting lib/libTMrbUtils.rootmap is:

[ libTMrbUtils.so ]
# List of selected classes
class TMbsWindow2d
class TMbsWindowF
...
header TMrbWdw.h
header TMrbEnv.h
...

So no reference to libGraf.so at all
and of course

gSystem->Load("libTMrbUtils.so");

results in:
cling::DynamicLibraryManager::loadLibrary():…undefined: _ZTI5TLine

So I am something important missing!

Any help appreciated

Otto

Hi Otto,

For each dependent library you want to specify add the option: -rml Rootmap library name Specify the name of the library which contains the autoload keys. This switch can be specified multiple times to autoload several libraries in presence of a particular key.

Note that we actually strongly recommend to no longer use this feature but instead rely on explicitly linking the dependent library to the library itself. I.e. g++ --shared -o libTMrbUtils.so .... ${OBJECT_FILES} ..... -lGrafThis allows to then add to that link line the flag-Wl,--no-undefined which will warn you of missing symbols (if any) at compile time rather than delaying the check until run-time.

Cheers,
Philippe.

Hi Otto,

I very much support the comments of Philippe.
In case you want to have more information about the switches supported by rootcling, you can always refer to the help prompted by the command “rootcling -h”.
Let me comment about the dictionary generation command you used, just for completeness:

rootcling -rootbuild -f utils/src/G__TMrbUtilsDict.cxx
-s  lib/libTMrbUtils.so -rml libTMrbUtils.so
-rmf lib/libTMrbUtils.rootmap
-m /software/opt/trusty/x86_64/root/6.04.18/lib/libGraf_rdict.pcm
-c -writeEmptyRootPCM
utils/inc/GlobDef.h utils/inc/SetColor.h utils/inc/ utils/inc/TMrbEnv.h
...
utils/inc/TMrbWdw.h utils/inc/LinkDef.h
  • The “-rootbuild” and “-writeEmptyRootPCM” are for internal use only, at least for the moment. They should not be used for generating dictionaries of user classes.
  • The switch “-c” is not necessary anymore.
  • In your invocation, the -s switch can be dropped.
  • The “-m” switch is presently not used by ROOT but will be as soon as clang C++ modules are supported: this is a very nice way to write a forward compatible infrastructure.

So, in short, if you want to generate a dictionary for your classes taking advantage of the linking feature mentioned by Philippe in the previous post, the command could look like:

rootcling -f utils/src/G__TMrbUtilsDict.cxx 
-rml libTMrbUtils.so 
-rmf lib/libTMrbUtils.rootmap 
-m /software/opt/trusty/x86_64/root/6.04.18/lib/libGraf_rdict.pcm
utils/inc/GlobDef.h utils/inc/SetColor.h utils/inc/ utils/inc/TMrbEnv.h
...
utils/inc/TMrbWdw.h utils/inc/LinkDef.h

Cheers,
Danilo

HI Philippe, Danilo,
thank you for the clarifying answers.
One question to Danilo still:
I modified the rootcling line as you suggested.
However if I drop

the name of the pcm file becomes:

instead of

Is this expected?

Cheers
Otto

Hi Otto,

yes. The input is taken from the output cxx file. To simplify your command, if this is possible in your setup and you want to do it, you can rename the autogenerated cxx dictionary file.

Cheers,
Danilo