Suggestions to partially compile the ./math component into Julia _jll library

Dear developers and experts,

I want to make the Root math functions accessible from Julia. The way to do it is, I guess, to have a successful minimal compilation of the source code in the ./math folder and then go over the procedures with BinaryBuilder.jl [1] on the Julia side. But I really don’t have a clue on how to start. The cmake files are too complicated for me to understand. I wish to get some general guidelines on how to compile the math component into a minimal dynamic library, with some properly written cmake files.

[1] Julia BindaryBuilder.jl is a facility to wrap and build C/C++ source code into libraries which are accessible from Julia. I cannot put links in the post, sorry.

Best,
Yunlong

Hi @ylian, welcome to the ROOT forum!

Interesting idea :+1: You don’t need to understand the ROOT CMake files to do this however.

What I would do here is to write new CMake files that use the same sources, but compile the math part standalone, maybe starting with math/mathcore. There is some example for this already in math/minuit2 actually, which also contains CMake files to build Minuit2 standalone!

Another example of a custom CMakeFile that compiles sources from the ROOT repository is the one in iminuit.

But even if you write your custom CMake files, then you’ll still have to deal with the dependency of math on the rest of ROOT before building math standalone. For example, mathcore uses the ROOT error logging and some classes inherit from TObject. The other math libraries sometimes even use ROOT histograms.

So what I would do is to follow the model of the iminuit developers and only compile a the limited subset of ROOT Math sources that you actually need in your project, maybe fixing the occasional ROOT dependency problem by changing the code itself (e.g., the TObject base class of TRandom could probably easily removed in your “fork” of ROOT math).

If you find good solutions to all of that, feel free to contribute your standalone build files back to ROOT, just like they are available for Minuit2! There are other users who would like to do the same thing:

I hope I could give you some ideas though.

Cheers,
Jonas

Hi @jonas , thanks for the nice tutorial. I am still doing the “homework”. Come back later!