Rootmap for classes added to root

I add classes to Root and also generate rootmap for them:

rootcint -f src/$ -rmf lib/$@.rootmap -c interface/$@.hh $@LinkDef.h

in Cint I load the library

gSystem -> Load(“path/”)

It seems the rootmap files which are in the same folder as the library are not picked up. How to solve? Should the rootmaps be in a separate library (-rml) which I then gSystem -> Load(). This library cannot be the same as

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

You don’t have to load the .rootmap files with gSystem->Load(). At least for me it works without.
I think the problem is a different one. As fas as I understand everything the .rootmap files are only used when you automatically add libraries for example by calling TClass::GetClass() on a class which has not yet been loaded, so they have nothing to do with gSystem->Load() where you explicitly load one library file and not a class.
The library files are therefore searched in the paths specified in the $LD_LIBRARY_PATH variable. Have you added the folder where your libraries are located to this variable? If not, add them using export LD_LIBRARY_PATH=<Absolute path of your library folder>:$LD_LIBRARY_PATH
I hope this solves your problem.

modfying LD_LIBRARY_PATH did not solve the problem

What do you mean? What is the actual symptom? (and yes the rootmap file and the library are expected to be in the same directory but depending on your use case and failure this may or may not be related to the failure you see)


I conclude the rootmap is not picked up by typing part of the class name in Cling and pressing TAB to see it expanded, e.g.

CompoundHisto TAB

expecting it to expand to


OK, so if I understand your problem right, you just want to be able to use autocompletion with your custom class without loading it manually using gSystem->Load() ?

I guess the simplest way of achieving this would be loading the library automatically whenever root is started. This can be achieved by a rootlogon.C macro whichs default location would be your private folder ~. Just create a file ~/rootlogon.C with the content:

void rootlogon() {
    gSystem->Load("<Your library's path>");

By this the library is loaded whenever root is started and you will be able to use autocompletion.

No, I am fine with maintaining gSystem -> Load()

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