Trouble with ROOT+libtorch make compilation

I see.
You are getting an undefined reference to RegisterModule, which is contained in libCore, but libCore seems to be linked if I read the log correctly. I’m confused.

I can’t see obvious errors in your CMakeLists.

Also libtorch does not seem to be involved.

Can you compile a simple application that uses RDataFrame only via CMake?

Hi,

I think it got lost in the discussion, taking out the Torch libraries there is no problem in having a cmake working, also with RDataFrame.
So the answer is yes, I am able to compile with cmake applications with RDataFrame.

Antonello.

It looks like your list in ROOT_LIBRARIES has no separator, so maybe the libraries are not actually being linked. Try using quoted and unquoted versions when linking, or separating the arguments by hand and checking if that solves your problem.

But how could introducing libtorch into the build break the linking of ROOT libraries…? I’m lost :sweat_smile:

Hi all, I rebuilt the setup provided by @amiucci in a separate environment and I have the exact same issues. Removing libtorch seems to fix the compilation problem.

My understanding is that by introducing the torch libraries the linking of ROOT got messed up, but I do not see really how and why by spying at the generated make command. I am lost in the comprehension of this and I was hoping to get some help exactly there.

By having a look into cmake guidelines it seems that target_link_libraries needs to handle the cross-dependancy, that you can find here: https://cmake.org/cmake/help/v3.0/command/target_link_libraries.html

Now I do not see how this applies directly to this case, it would be interesting to understand if there is a piece of code in which ROOT is used together with other libraries in cmake, so that we can have a reference to look at and try to write our own application.

Similar problem to using both set(VAR ${VAR} ...) and list(APPEND VAR ...) freely in CMake. Eventually CMake will mess up the ; that separates the list and you’ll end up with one string with everything, or many broken strings that are not correct.