Options to use the {fmt} library in ROOT

Dear ROOTers,

I am an enthusiastic user of the {fmt} library that cannot wait for having it fully integrated in the c++ std, also because I have to deal with less recent OS that does not offer the necessary gcc version.

I am also using it with ROOT in FMT_HEADER_ONLY mode, and it works like a charm in the interactive environment, in scripts, even in the ROOT jupyter notebook, and I guess (I have not tried so far) it will work also on ACLiC compilation.

Now I would like to use it also as a loaded/linked library, and I wonder:

  • if somebody is already doing that
  • which are the options that I have to achieve this (e.g. other libraries can be “loaded” with gSystem::Load(), I read here ROOT macros and shared libraries - ROOT that libraries can be added for compilation and include path can be edited with other gSystem methods)

The best for me is to have e.g. something in the configuration file that makes it available from the start of the program, as with the std library and the ROOT libraries. So far I mostly installed ROOT from sources with c++17 enabled, on Debian machines.

I look forward to any suggestion

Best,
Matteo


Please read tips for efficient and successful posting and posting code

ROOT Version: Any recent (~>=6.26), compiled with c++17
Platform: Debian10 to (soon) Debian12
Compiler: gcc (from 8.3 to 12.2 depending on Debian version)


May be your question is similar to:

Thanks for the quick hint.

I think that it is complementary to that topic, in the sense that the other post asked how to load the library just before or at the beginning of each macro, while I am more interested to have {fmt} available at ROOT start for any interactive work or scripts that I run.

Still from that post I get a suggestion, to put the loading in rootlogon.C. However this is per-user basis, is there any field of the system.rootrc that can provide this, or anything else ?

Thanks again,
Matteo

You would like to have a system-wide rootlogon.C?

Well, the ultimate wish would be that the users could have the same “experience” when using std library symbols like std::cout, etc.
Wait, let me be more precise: not to the point that they do not have to #include the headers or they find everything in the global namespace, but without the need to R__LOAD_LIBRARY + gSystem->Load() at the beginning of their macro or session

I looked at the etc/system.rootrc:

# Path used by dynamic loader to find shared libraries.                                                                                                                                       
# This path will be appended to the (DY)LD_LIBRARY_PATH on Unix                                                                                                                               
# and to PATH on Windows.                                                                                                                                                                     
# Paths are different for Unix and Windows. The example shows the defaults                                                                                                                    
# for all ROOT applications for either Unix or Windows.                                                                                                                                       
#Unix.*.Root.DynamicPath:    .:$(ROOTSYS)/lib                                                                                                                                                 
#WinNT.*.Root.DynamicPath:   .;$(ROOTSYS)/bin                                                                                                                                                 

But I guess that this sets just the search path and you cannot load a library at startup via this configuration file.
So probably a starting macro would be needed. Is there really a system-wide rootlogon.C ??

Otherwise I guess now that the workaround is either to provide the rootlogon.C so that users can take it, if they want to, or provide a wrapper script that launch root with the a prepared rootlogon.C as first operation.

I will make some tests, thanks for the help

See: ROOT: TRint Class Reference

You can also create a rootlogon.C file in ${ROOTSYS}/macros

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