Trouble with ROOT+libtorch make compilation

Dear Root forum members,

I am hitting a problem with cmake compilation and ROOT libraries.

I have followed the ROOT guide to create a CMakeLists for my code and I managed to have a compiled running code. (Here the guide that I have followed: https://root.cern.ch/how/integrate-root-my-project-cmake)

Now, I want to add to my code some external libraries for Neural Network. This is pytorch.
They come with a make example that you can find here:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(custom_ops)

find_package(Torch REQUIRED)

add_executable(example-app example-app.cpp)
target_link_libraries(example-app "${TORCH_LIBRARIES}")
set_property(TARGET example-app PROPERTY CXX_STANDARD 11)

In order to be compatible with RDataFrame I am targeting CXX_STANDARD 17:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(event)

# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
#   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
#   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
set(ENV{TORCH} "lib/libtorch")
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
list(APPEND CMAKE_PREFIX_PATH $ENV{TORCH})

foreach(path ${CMAKE_PREFIX_PATH})
  message("Path: " ${path})
endforeach(path)

message("Torch Libraries: " ${TORCH_LIBRARIES})

#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
find_package(ROOT REQUIRED COMPONENTS MathCore RIO Hist Tree Net)
find_package(Torch REQUIRED)

#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})

include_directories(${CMAKE_SOURCE_DIR} ${ROOT_INCLUDE_DIRS})
include_directories(./include/)
add_definitions(${ROOT_CXX_FLAGS})

ROOT_GENERATE_DICTIONARY(G__LoopSUSYThTh include/LoopSUSYThTh.h)
ROOT_GENERATE_DICTIONARY(G__LoopSUSYTN1TbC1 include/LoopSUSYTN1TbC1.h)
ROOT_GENERATE_DICTIONARY(G__LoopSUSYTZTZ include/LoopSUSYTZTZ.h)
ROOT_GENERATE_DICTIONARY(G__LoopSUSYSleptons include/LoopSUSYSleptons.h)
ROOT_GENERATE_DICTIONARY(G__LoopSUSYFrame include/LoopSUSYFrame.h)
ROOT_GENERATE_DICTIONARY(G__LoopSUSYTorch include/LoopSUSYTorch.h)
ROOT_GENERATE_DICTIONARY(G__GenericHelpers include/GenericHelpers.h)
ROOT_GENERATE_DICTIONARY(G__LeptonHelpers include/LeptonHelpers.h)
ROOT_GENERATE_DICTIONARY(G__LoopSUSYClaudio include/LoopSUSYClaudio.h)

#---Create a shared library with geneated dictionary
add_library(libLoopSUSYThTh SHARED src/LoopSUSYThTh.cxx)
add_library(libLoopSUSYTN1TbC1 SHARED src/LoopSUSYTN1TbC1.cxx)
add_library(libLoopSUSYTZTZ SHARED src/LoopSUSYTZTZ.cxx)
add_library(libLoopSUSYSleptons SHARED src/LoopSUSYSleptons.cxx)
add_library(libLoopSUSYFrame SHARED src/LoopSUSYFrame.cxx)
add_library(libLoopSUSYClaudio SHARED src/LoopSUSYClaudio.cxx)
add_library(libLoopSUSYTorch SHARED src/LoopSUSYTorch.cxx)
add_library(libGenericHelpers SHARED src/GenericHelpers.cxx)
add_library(libLeptonHelpers SHARED src/LeptonHelpers.cxx)

# THIS LINE IS CREATING THE ISSUE
#target_link_libraries(libLoopSUSYThTh "${TORCH_LIBRARIES}")

target_link_libraries(libLoopSUSYThTh ${ROOT_LIBRARIES})# ${TORCH_LIBRARIES})
target_link_libraries(libLoopSUSYTZTZ libLeptonHelpers libLoopSUSYTN1TbC1 libLoopSUSYFrame libLoopSUSYClaudio libLoopSUSYTorch libGenericHelpers ${ROOT_LIBRARIES})# ${TORCH_LIBRARIES})

#---Create  a main program using the library
add_executable(ntupleMaker src/main.cxx)
target_link_libraries(ntupleMaker libLoopSUSYThTh libLoopSUSYTZTZ libLeptonHelpers libLoopSUSYTN1TbC1 libLoopSUSYSleptons libLoopSUSYTZTZ libLoopSUSYFrame libLoopSUSYClaudio libLoopSUSYTorch libGenericHelpers)
set_property(TARGET ntupleMaker libLoopSUSYThTh libLoopSUSYTZTZ libLeptonHelpers libLoopSUSYTN1TbC1 libLoopSUSYSleptons libLoopSUSYTZTZ libLoopSUSYFrame libLoopSUSYClaudio libLoopSUSYTorch libGenericHelpers PROPERTY CXX_STANDARD 17)

Now the issue shows up, if I add the line target_link_libraries(libLoopSUSYThTh “${TORCH_LIBRARIES}”) for linking my libtorch NN, I got the following error:

-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/gcc
-- Check for working C compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++
-- Check for working CXX compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Path: /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt
Path: lib/libtorch
Torch Libraries: 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found torch: /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libtorch.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build
Scanning dependencies of target libLoopSUSYFrame
[  5%] Building CXX object CMakeFiles/libLoopSUSYFrame.dir/src/LoopSUSYFrame.cxx.o
[ 10%] Linking CXX shared library liblibLoopSUSYFrame.so
[ 10%] Built target libLoopSUSYFrame
Scanning dependencies of target libLeptonHelpers
[ 15%] Building CXX object CMakeFiles/libLeptonHelpers.dir/src/LeptonHelpers.cxx.o
/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/src/LeptonHelpers.cxx: In function ‘std::pair<std::array<float, 4ul>, std::array<int, 3ul> > ClosestMllVars(const std::vector<short unsigned int, std::allocator<short unsigned int> >&, const std::vector<float, std::allocator<float> >&, const std::vector<float, std::allocator<float> >&, const std::vector<float, std::allocator<float> >&, const std::vector<float, std::allocator<float> >&, const std::vector<int, std::allocator<int> >&)’:
/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/src/LeptonHelpers.cxx:107:46: warning: narrowing conversion of ‘(((double)closest_mll) / 1.0e+3)’ from ‘double’ to ‘float’ inside { } [-Wnarrowing]
  std::array<float, 4> the_vars = {closest_mll/1000., closest_ptll/1000., closest_dphill, closest_phi};
                                   ~~~~~~~~~~~^~~~~~
/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/src/LeptonHelpers.cxx:107:66: warning: narrowing conversion of ‘(((double)closest_ptll) / 1.0e+3)’ from ‘double’ to ‘float’ inside { } [-Wnarrowing]
  std::array<float, 4> the_vars = {closest_mll/1000., closest_ptll/1000., closest_dphill, closest_phi};
                                                      ~~~~~~~~~~~~^~~~~~
[ 20%] Linking CXX shared library liblibLeptonHelpers.so
[ 20%] Built target libLeptonHelpers
Scanning dependencies of target libLoopSUSYTorch
[ 25%] Building CXX object CMakeFiles/libLoopSUSYTorch.dir/src/LoopSUSYTorch.cxx.o
[ 30%] Linking CXX shared library liblibLoopSUSYTorch.so
[ 30%] Built target libLoopSUSYTorch
Scanning dependencies of target libLoopSUSYThTh
[ 35%] Building CXX object CMakeFiles/libLoopSUSYThTh.dir/src/LoopSUSYThTh.cxx.o
[ 40%] Linking CXX shared library liblibLoopSUSYThTh.so
[ 40%] Built target libLoopSUSYThTh
Scanning dependencies of target libLoopSUSYTN1TbC1
[ 45%] Building CXX object CMakeFiles/libLoopSUSYTN1TbC1.dir/src/LoopSUSYTN1TbC1.cxx.o
[ 50%] Linking CXX shared library liblibLoopSUSYTN1TbC1.so
[ 50%] Built target libLoopSUSYTN1TbC1
Scanning dependencies of target libGenericHelpers
[ 55%] Building CXX object CMakeFiles/libGenericHelpers.dir/src/GenericHelpers.cxx.o
[ 60%] Linking CXX shared library liblibGenericHelpers.so
[ 60%] Built target libGenericHelpers
Scanning dependencies of target libLoopSUSYClaudio
[ 65%] Building CXX object CMakeFiles/libLoopSUSYClaudio.dir/src/LoopSUSYClaudio.cxx.o
[ 70%] Linking CXX shared library liblibLoopSUSYClaudio.so
[ 70%] Built target libLoopSUSYClaudio
Scanning dependencies of target libLoopSUSYTZTZ
[ 75%] Building CXX object CMakeFiles/libLoopSUSYTZTZ.dir/src/LoopSUSYTZTZ.cxx.o
[ 80%] Linking CXX shared library liblibLoopSUSYTZTZ.so
[ 80%] Built target libLoopSUSYTZTZ
Scanning dependencies of target libLoopSUSYSleptons
[ 85%] Building CXX object CMakeFiles/libLoopSUSYSleptons.dir/src/LoopSUSYSleptons.cxx.o
[ 90%] Linking CXX shared library liblibLoopSUSYSleptons.so
[ 90%] Built target libLoopSUSYSleptons
Scanning dependencies of target ntupleMaker
[ 95%] Building CXX object CMakeFiles/ntupleMaker.dir/src/main.cxx.o
[100%] Linking CXX executable ntupleMaker
CMakeFiles/ntupleMaker.dir/src/main.cxx.o: In function `main':
main.cxx:(.text+0x1abf): undefined reference to `TString::TString(std::string const&)'
main.cxx:(.text+0x1df7): undefined reference to `TString::TString(std::string const&)'
main.cxx:(.text+0x2034): undefined reference to `TString::TString(std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GraphDrawing::CreateDefineNode(std::string const&, ROOT::Detail::RDF::RCustomColumnBase const*)'
liblibLoopSUSYThTh.so: undefined reference to `AddWeightBranches(std::vector<std::string, std::allocator<std::string> >&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RActionBase::RActionBase(ROOT::Detail::RDF::RLoopManager*, std::vector<std::string, std::allocator<std::string> > const&, ROOT::Internal::RDF::RBookedCustomColumns&&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::TTreeReaderValueBase::GetElementTypeName(std::type_info const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::InterpreterCalc(std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::FindUndefinedDSColumns(std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<float>::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<int>::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::PrettyPrintAddr(void const*)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Detail::RDF::RLoopManager::GetBranchNames()'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::DemangleTypeIdName(std::type_info const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::CheckCustomColumn(std::experimental::fundamentals_v1::basic_string_view<char, std::char_traits<char> >, TTree*, std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GraphDrawing::CheckIfDefaultOrDSColumn(std::string const&, std::shared_ptr<ROOT::Detail::RDF::RCustomColumnBase> const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GetBranchNames(TTree&, bool)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::BookDefineJit(std::experimental::fundamentals_v1::basic_string_view<char, std::char_traits<char> >, std::experimental::fundamentals_v1::basic_string_view<char, std::char_traits<char> >, ROOT::Detail::RDF::RLoopManager&, ROOT::RDF::RDataSource*, std::shared_ptr<ROOT::Detail::RDF::RJittedCustomColumn> const&, ROOT::Internal::RDF::RBookedCustomColumns const&, std::vector<std::string, std::allocator<std::string> > const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GetValidatedColumnNames(ROOT::Detail::RDF::RLoopManager&, unsigned int, std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&, ROOT::RDF::RDataSource*)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::InterpreterDeclare(std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::ColumnName2ColumnTypeName(std::string const&, unsigned int, TTree*, ROOT::RDF::RDataSource*, bool, bool, unsigned int)'
liblibLoopSUSYThTh.so: undefined reference to `GetLeptonBranches(bool, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<std::vector<int, std::allocator<int> > >::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<unsigned int>::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::TypeID2TypeName(std::type_info const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Detail::RDF::RCustomColumnBase::GetName() const'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<std::vector<float, std::allocator<float> > >::MakeProxy(TTreeReader*, std::string const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [ntupleMaker] Errore 1
make[1]: *** [CMakeFiles/ntupleMaker.dir/all] Errore 2
make: *** [all] Errore 2

This is weird because I was not expecting the link of another library messing up the one for ROOT.

On my code, at the moment, there is nothing that uses the libtorch library, I am planning to add the relevant code in a next step.

Thank you very much for any inputs there,

Cheers,
Antonello

Can you please post the verbose output of calling cmake --build . on the build directory? I think the command line may have messed up options depending on the quotes or how the variables are used in the CMake commands.

Hi Guilherme,

thank you very much for your answer.
here the cmake --build . output of my build folder:

amiucci@ui01:~/LoopSUSYFrame_rel21/LoopSUSYFrame/build$ cmake --debug_outuput --built . 
Path: /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt
Path: lib/libtorch
Torch Libraries: 
-- Configuring done
-- Generating done
-- Build files have been written to: /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build

The path looks correct to me.

Antonello.

Here the DependInfo.cmake of the LoopSUSYThTh.cxx file, which is the one I am linking the libtorch library:

# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
  "CXX"
  )
# The set of files for implicit dependencies of each language:
set(CMAKE_DEPENDS_CHECK_CXX
  "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/src/LoopSUSYThTh.cxx" "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYThTh.dir/src/LoopSUSYThTh.cxx.o"
  )
set(CMAKE_CXX_COMPILER_ID "GNU")

# The include file search paths:
set(CMAKE_CXX_TARGET_INCLUDE_PATH
  "/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/include"
  "../"
  ".././include"
  "../lib/libtorch/include"
  "../lib/libtorch/include/torch/csrc/api/include"
  )

# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
  )

# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")

There are two typos on your command line. Also this will not run the build. What I meant was for you to call either make VERBOSE=1 or ninja -v so that the compilation commands are visible.

Sorry, I did not got what you meant. The output of the make VERBOSE=1 is the following (limiting to the part where the code is having issues):

[ 95%] Linking CXX executable ntupleMaker
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_link_script CMakeFiles/ntupleMaker.dir/link.txt --verbose=1
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++    -std=c++14 -pipe -fsigned-char -pthread  -rdynamic CMakeFiles/ntupleMaker.dir/src/main.cxx.o  -o ntupleMaker  -L/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib -Wl,-rpath,/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib liblibLoopSUSYThTh.so liblibLoopSUSYSleptons.so liblibLoopSUSYTZTZ.so liblibLoopSUSYFrame.so liblibLoopSUSYClaudio.so liblibLoopSUSYTorch.so liblibGenericHelpers.so ../lib/libtorch/lib/libtorch.so -Wl,--no-as-needed,/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libcaffe2.so -Wl,--as-needed ../lib/libtorch/lib/libc10.so -lpthread liblibLeptonHelpers.so liblibLoopSUSYTN1TbC1.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libImt.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRIO.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libNet.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libHist.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf3d.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGpad.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libROOTDataFrame.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTree.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTreePlayer.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRint.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPostscript.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMatrix.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPhysics.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMathCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libThread.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMultiProc.so
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[1]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'

Here the complete log:

/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -H/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame -B/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build --check-build-system CMakeFiles/Makefile.cmake 0
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_progress_start /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYFrame.dir/build.make CMakeFiles/libLoopSUSYFrame.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYFrame.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYFrame.dir/build.make CMakeFiles/libLoopSUSYFrame.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYFrame.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 10%] Built target libLoopSUSYFrame
make -f CMakeFiles/libLeptonHelpers.dir/build.make CMakeFiles/libLeptonHelpers.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLeptonHelpers.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLeptonHelpers.dir/build.make CMakeFiles/libLeptonHelpers.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLeptonHelpers.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 20%] Built target libLeptonHelpers
make -f CMakeFiles/libLoopSUSYTorch.dir/build.make CMakeFiles/libLoopSUSYTorch.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYTorch.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYTorch.dir/build.make CMakeFiles/libLoopSUSYTorch.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYTorch.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 30%] Built target libLoopSUSYTorch
make -f CMakeFiles/libLoopSUSYThTh.dir/build.make CMakeFiles/libLoopSUSYThTh.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYThTh.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYThTh.dir/build.make CMakeFiles/libLoopSUSYThTh.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 40%] Built target libLoopSUSYThTh
make -f CMakeFiles/libLoopSUSYTN1TbC1.dir/build.make CMakeFiles/libLoopSUSYTN1TbC1.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYTN1TbC1.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYTN1TbC1.dir/build.make CMakeFiles/libLoopSUSYTN1TbC1.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYTN1TbC1.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 50%] Built target libLoopSUSYTN1TbC1
make -f CMakeFiles/libGenericHelpers.dir/build.make CMakeFiles/libGenericHelpers.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libGenericHelpers.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libGenericHelpers.dir/build.make CMakeFiles/libGenericHelpers.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libGenericHelpers.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 60%] Built target libGenericHelpers
make -f CMakeFiles/libLoopSUSYClaudio.dir/build.make CMakeFiles/libLoopSUSYClaudio.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYClaudio.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYClaudio.dir/build.make CMakeFiles/libLoopSUSYClaudio.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYClaudio.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 70%] Built target libLoopSUSYClaudio
make -f CMakeFiles/libLoopSUSYTZTZ.dir/build.make CMakeFiles/libLoopSUSYTZTZ.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYTZTZ.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYTZTZ.dir/build.make CMakeFiles/libLoopSUSYTZTZ.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYTZTZ.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 80%] Built target libLoopSUSYTZTZ
make -f CMakeFiles/libLoopSUSYSleptons.dir/build.make CMakeFiles/libLoopSUSYSleptons.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYSleptons.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYSleptons.dir/build.make CMakeFiles/libLoopSUSYSleptons.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYSleptons.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 90%] Built target libLoopSUSYSleptons
make -f CMakeFiles/ntupleMaker.dir/build.make CMakeFiles/ntupleMaker.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/ntupleMaker.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/ntupleMaker.dir/build.make CMakeFiles/ntupleMaker.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 95%] Linking CXX executable ntupleMaker
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_link_script CMakeFiles/ntupleMaker.dir/link.txt --verbose=1
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++    -std=c++14 -pipe -fsigned-char -pthread  -rdynamic CMakeFiles/ntupleMaker.dir/src/main.cxx.o  -o ntupleMaker  -L/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib -Wl,-rpath,/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib liblibLoopSUSYThTh.so liblibLoopSUSYSleptons.so liblibLoopSUSYTZTZ.so liblibLoopSUSYFrame.so liblibLoopSUSYClaudio.so liblibLoopSUSYTorch.so liblibGenericHelpers.so ../lib/libtorch/lib/libtorch.so -Wl,--no-as-needed,/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libcaffe2.so -Wl,--as-needed ../lib/libtorch/lib/libc10.so -lpthread liblibLeptonHelpers.so liblibLoopSUSYTN1TbC1.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libImt.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRIO.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libNet.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libHist.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf3d.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGpad.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libROOTDataFrame.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTree.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTreePlayer.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRint.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPostscript.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMatrix.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPhysics.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMathCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libThread.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMultiProc.so
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[1]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'

You seem to have cut off the actual error.

That is due to me pushing the output in the log file.
There is still this error message popping up:

CMakeFiles/ntupleMaker.dir/src/main.cxx.o: In function `main':
main.cxx:(.text+0x1abf): undefined reference to `TString::TString(std::string const&)'
main.cxx:(.text+0x1df7): undefined reference to `TString::TString(std::string const&)'
main.cxx:(.text+0x2034): undefined reference to `TString::TString(std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GraphDrawing::CreateDefineNode(std::string const&, ROOT::Detail::RDF::RCustomColumnBase const*)'
liblibLoopSUSYThTh.so: undefined reference to `AddWeightBranches(std::vector<std::string, std::allocator<std::string> >&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RActionBase::RActionBase(ROOT::Detail::RDF::RLoopManager*, std::vector<std::string, std::allocator<std::string> > const&, ROOT::Internal::RDF::RBookedCustomColumns&&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::TTreeReaderValueBase::GetElementTypeName(std::type_info const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::InterpreterCalc(std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::FindUndefinedDSColumns(std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<float>::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<int>::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::PrettyPrintAddr(void const*)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Detail::RDF::RLoopManager::GetBranchNames()'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::DemangleTypeIdName(std::type_info const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::CheckCustomColumn(std::experimental::fundamentals_v1::basic_string_view<char, std::char_traits<char> >, TTree*, std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GraphDrawing::CheckIfDefaultOrDSColumn(std::string const&, std::shared_ptr<ROOT::Detail::RDF::RCustomColumnBase> const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GetBranchNames(TTree&, bool)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::BookDefineJit(std::experimental::fundamentals_v1::basic_string_view<char, std::char_traits<char> >, std::experimental::fundamentals_v1::basic_string_view<char, std::char_traits<char> >, ROOT::Detail::RDF::RLoopManager&, ROOT::RDF::RDataSource*, std::shared_ptr<ROOT::Detail::RDF::RJittedCustomColumn> const&, ROOT::Internal::RDF::RBookedCustomColumns const&, std::vector<std::string, std::allocator<std::string> > const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::GetValidatedColumnNames(ROOT::Detail::RDF::RLoopManager&, unsigned int, std::vector<std::string, std::allocator<std::string> > const&, std::vector<std::string, std::allocator<std::string> > const&, ROOT::RDF::RDataSource*)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::InterpreterDeclare(std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::ColumnName2ColumnTypeName(std::string const&, unsigned int, TTree*, ROOT::RDF::RDataSource*, bool, bool, unsigned int)'
liblibLoopSUSYThTh.so: undefined reference to `GetLeptonBranches(bool, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<std::vector<int, std::allocator<int> > >::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<unsigned int>::MakeProxy(TTreeReader*, std::string const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::TypeID2TypeName(std::type_info const&)'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Detail::RDF::RCustomColumnBase::GetName() const'
liblibLoopSUSYThTh.so: undefined reference to `ROOT::Internal::RDF::RColumnValue<std::vector<float, std::allocator<float> > >::MakeProxy(TTreeReader*, std::string const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [ntupleMaker] Errore 1
make[1]: *** [CMakeFiles/ntupleMaker.dir/all] Errore 2
make: *** [all] Errore 2

From the command line it seems that your libraries should come after ROOT’s libraries in the linking step. The ordering is important. You probably should use target_link_libraries(lib PUBLIC libs_to_link) in your CMakeLists.txt. You are probably missing libraries in the list or the order is not correct. Another possibility is that ${ROOT_LIBRARIES} does not contain all libraries you need from ROOT, since that’s a common set and not the full set. If you see missing symbols, try to add the library that provides those symbols. For example, you probably need to add ROOT::ROOTDataFrame in addition to ${ROOT_LIBRARIES}.

Hi Guillerme,

I would exclude explicit dependancies from ROOT. If I do not put the line

target_link_libraries(libLoopSUSYThTh "${TORCH_LIBRARIES}")

the code compiles with no issues.

Also, I can compile a standalone application of the libtorch. So I would excluded some missing dependancy.

I tried to implement your suggestion by target the libraries in the following way:

target_link_libraries(libLoopSUSYThTh PUBLIC ${ROOT_LIBRARIES} PUBLIC ${TORCH_LIBRARIES})

Unfortunately I still have the same error.

Is there something I am missing from your suggestion?

Thanks for the patience.
Antonello.

The above looks strange. Can you post the output that compiles?

(also please check that ${ROOT_LIBRARIES} contains ROOTDataFrame or ROOT::ROOTDataFrame)

/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -H/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame -B/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build --check-build-system CMakeFiles/Makefile.cmake 0
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_progress_start /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYFrame.dir/build.make CMakeFiles/libLoopSUSYFrame.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYFrame.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYFrame.dir/build.make CMakeFiles/libLoopSUSYFrame.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYFrame.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 10%] Built target libLoopSUSYFrame
make -f CMakeFiles/libLeptonHelpers.dir/build.make CMakeFiles/libLeptonHelpers.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLeptonHelpers.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLeptonHelpers.dir/build.make CMakeFiles/libLeptonHelpers.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLeptonHelpers.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 20%] Built target libLeptonHelpers
make -f CMakeFiles/libLoopSUSYTorch.dir/build.make CMakeFiles/libLoopSUSYTorch.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYTorch.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYTorch.dir/build.make CMakeFiles/libLoopSUSYTorch.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYTorch.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 30%] Built target libLoopSUSYTorch
make -f CMakeFiles/libLoopSUSYThTh.dir/build.make CMakeFiles/libLoopSUSYThTh.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYThTh.dir/DependInfo.cmake --color=
Dependee "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYThTh.dir/DependInfo.cmake" is newer than depender "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYThTh.dir/depend.internal".
Scanning dependencies of target libLoopSUSYThTh
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYThTh.dir/build.make CMakeFiles/libLoopSUSYThTh.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 35%] Building CXX object CMakeFiles/libLoopSUSYThTh.dir/src/LoopSUSYThTh.cxx.o
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++  -DlibLoopSUSYThTh_EXPORTS -I/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/include -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/./include  -std=c++14 -pipe -fsigned-char -pthread -fPIC    -std=c++14 -pipe -fsigned-char -pthread -std=gnu++1z -o CMakeFiles/libLoopSUSYThTh.dir/src/LoopSUSYThTh.cxx.o -c /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/src/LoopSUSYThTh.cxx
[ 40%] Linking CXX shared library liblibLoopSUSYThTh.so
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_link_script CMakeFiles/libLoopSUSYThTh.dir/link.txt --verbose=1
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++ -fPIC   -std=c++14 -pipe -fsigned-char -pthread  -shared -Wl,-soname,liblibLoopSUSYThTh.so -o liblibLoopSUSYThTh.so CMakeFiles/libLoopSUSYThTh.dir/src/LoopSUSYThTh.cxx.o  -L/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib -Wl,-rpath,/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libImt.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRIO.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libNet.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libHist.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf3d.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGpad.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libROOTDataFrame.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTree.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTreePlayer.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRint.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPostscript.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMatrix.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPhysics.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMathCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libThread.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMultiProc.so
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 40%] Built target libLoopSUSYThTh
make -f CMakeFiles/libLoopSUSYTN1TbC1.dir/build.make CMakeFiles/libLoopSUSYTN1TbC1.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYTN1TbC1.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYTN1TbC1.dir/build.make CMakeFiles/libLoopSUSYTN1TbC1.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYTN1TbC1.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 50%] Built target libLoopSUSYTN1TbC1
make -f CMakeFiles/libGenericHelpers.dir/build.make CMakeFiles/libGenericHelpers.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libGenericHelpers.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libGenericHelpers.dir/build.make CMakeFiles/libGenericHelpers.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libGenericHelpers.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 60%] Built target libGenericHelpers
make -f CMakeFiles/libLoopSUSYClaudio.dir/build.make CMakeFiles/libLoopSUSYClaudio.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYClaudio.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYClaudio.dir/build.make CMakeFiles/libLoopSUSYClaudio.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYClaudio.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 70%] Built target libLoopSUSYClaudio
make -f CMakeFiles/libLoopSUSYTZTZ.dir/build.make CMakeFiles/libLoopSUSYTZTZ.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYTZTZ.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYTZTZ.dir/build.make CMakeFiles/libLoopSUSYTZTZ.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYTZTZ.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 80%] Built target libLoopSUSYTZTZ
make -f CMakeFiles/libLoopSUSYSleptons.dir/build.make CMakeFiles/libLoopSUSYSleptons.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/libLoopSUSYSleptons.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/libLoopSUSYSleptons.dir/build.make CMakeFiles/libLoopSUSYSleptons.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make[2]: Nessuna operazione da eseguire per «CMakeFiles/libLoopSUSYSleptons.dir/build».
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 90%] Built target libLoopSUSYSleptons
make -f CMakeFiles/ntupleMaker.dir/build.make CMakeFiles/ntupleMaker.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/ntupleMaker.dir/DependInfo.cmake --color=
Dependee "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/ntupleMaker.dir/DependInfo.cmake" is newer than depender "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles/ntupleMaker.dir/depend.internal".
Scanning dependencies of target ntupleMaker
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
make -f CMakeFiles/ntupleMaker.dir/build.make CMakeFiles/ntupleMaker.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[ 95%] Building CXX object CMakeFiles/ntupleMaker.dir/src/main.cxx.o
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++   -I/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/include -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/./include  -std=c++14 -pipe -fsigned-char -pthread    -std=c++14 -pipe -fsigned-char -pthread -std=gnu++1z -o CMakeFiles/ntupleMaker.dir/src/main.cxx.o -c /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/src/main.cxx
[100%] Linking CXX executable ntupleMaker
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_link_script CMakeFiles/ntupleMaker.dir/link.txt --verbose=1
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++    -std=c++14 -pipe -fsigned-char -pthread  -rdynamic CMakeFiles/ntupleMaker.dir/src/main.cxx.o  -o ntupleMaker  -L/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib -Wl,-rpath,/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build liblibLoopSUSYThTh.so liblibLoopSUSYSleptons.so liblibLoopSUSYTZTZ.so liblibLoopSUSYFrame.so liblibLoopSUSYClaudio.so liblibLoopSUSYTorch.so liblibGenericHelpers.so liblibLeptonHelpers.so liblibLoopSUSYTN1TbC1.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libImt.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRIO.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libNet.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libHist.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf3d.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGpad.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libROOTDataFrame.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTree.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTreePlayer.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRint.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPostscript.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMatrix.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPhysics.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMathCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libThread.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Thu/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMultiProc.so
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
[100%] Built target ntupleMaker
make[1]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build'
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_progress_start /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/build/CMakeFiles 0

As you can see the libROOTDataFrame.so shows up as expected.

Dear @eguiraud and @amadio,

I had another trial with a simpler code, based on the Event example provided here: https://root.cern.ch/how/integrate-root-my-project-cmake

I have implemented a simple call to the libtorch libraries in the Event.cxx file, so that the Build method is now:

void Event::Build(Int_t ev, Int_t arg5, Float_t ptmin) {

// CALLING THE NEURAL NETWORK
  std::string training = "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/data/jitstatelr0.1_batch10000_IxL15x5.pt";
  torch::Device device(torch::kCPU);
  if (torch::cuda::is_available()) {
    std::cout << "CUDA is available! Training on GPU." << std::endl;
    device = torch::Device(torch::kCUDA);
  }
  // Model Loading
  std::shared_ptr<torch::jit::script::Module> module = torch::jit::load(training.c_str());
  assert(module != nullptr);
  std::cout << "Model Loaded\n";
  module->to(device);
  module->eval();
fIsValid = kTRUE;
  char etype[20];
  Float_t sigmat, sigmas;
  gRandom->Rannor(sigmat,sigmas);
  Int_t ntrack   = Int_t(arg5 +arg5*sigmat/120.);
  Float_t random = gRandom->Rndm(1);

  //Save current Object count
  Int_t ObjectNumber = TProcessID::GetObjectCount();
  Clear();
  fHighPt->Delete();
  fMuons->Delete();

  Int_t nch = 15;
  if (ev >= 100)   nch += 3;
  if (ev >= 10000) nch += 3;
  if (fEventName) delete [] fEventName;
  fEventName = new char[nch];
  sprintf(fEventName,"Event%d_Run%d",ev,200);
  sprintf(etype,"type%d",ev%5);
  SetType(etype);
  SetHeader(ev, 200, 960312, random);
  SetNseg(Int_t(10*ntrack+20*sigmas));
  SetNvertex(Int_t(1+20*gRandom->Rndm()));
  SetFlag(UInt_t(random+0.5));
  SetTemperature(random+20.);

  for(UChar_t m = 0; m < 10; m++) {
     SetMeasure(m, Int_t(gRandom->Gaus(m,m+1)));
  }
  for(UChar_t i0 = 0; i0 < 4; i0++) {
    for(UChar_t i1 = 0; i1 < 4; i1++) {
       SetMatrix(i0,i1,gRandom->Gaus(i0*i1,1));
    }
  }

  fTriggerBits.SetBitNumber((UInt_t)(64*gRandom->Rndm(1)));
  fTriggerBits.SetBitNumber((UInt_t)(64*gRandom->Rndm(1)));
  fTriggerBits.SetBitNumber((UInt_t)(64*gRandom->Rndm(1)));

 //  Create and Fill the Track objects
  for (Int_t t = 0; t < ntrack; t++) AddTrack(random,ptmin);

  //Restore Object count 
  //To save space in the table keeping track of all referenced objects
  //we assume that our events do not address each other. We reset the 
  //object count to what it was at the beginning of the event.
  TProcessID::SetObjectCount(ObjectNumber);
}

My CMakeLists.txt looks like:

# CMakeLists.txt for event package. It creates a library with dictionary and a main program
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(event)

# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
#   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
#   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
set(ENV{TORCH} "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch")
set(ENV{TORCH_INCLUDE_DIRS} "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include")
list(APPEND CMAKE_PREFIX_PATH $ENV{TORCH})
list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})

foreach(path ${CMAKE_PREFIX_PATH})
  message("Path: " ${path})
endforeach(path)

#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
find_package(ROOT REQUIRED COMPONENTS MathCore RIO Hist Tree Net)
find_package(Torch REQUIRED)

#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})

include_directories(${CMAKE_SOURCE_DIR} ${ROOT_INCLUDE_DIRS} ${TORCH_INCLUDE_DIRS})
add_definitions(${ROOT_CXX_FLAGS})

ROOT_GENERATE_DICTIONARY(G__Event Event.h LINKDEF EventLinkDef.h)

#---Create a shared library with geneated dictionary
add_library(Event SHARED Event.cxx G__Event.cxx)
#target_link_libraries(Event ${TORCH_LIRABRIES})# ${ROOT_LIBRARIES})
target_link_libraries(Event PUBLIC ${TORCH_LIBRARIES})# ${ROOT_LIBRARIES})
target_link_libraries(Event PUBLIC ${ROOT_LIBRARIES})# ${TORCH_LIBRARIES})

#---Create  a main program using the library
add_executable(Main MainEvent.cxx)
target_link_libraries(Main Event)
set_property(TARGET Main Event PROPERTY CXX_STANDARD 17)

I still have the same error appearing:

amiucci@ui01:~/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build$ cmake ..; make VERBOSE=1
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/gcc
-- Check for working C compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++
-- Check for working CXX compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Path: /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch
Path: /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found torch: /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libtorch.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -H/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event -B/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build --check-build-system CMakeFiles/Makefile.cmake 0
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_progress_start /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
make -f CMakeFiles/Event.dir/build.make CMakeFiles/Event.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
[ 16%] Generating G__Event.cxx, libEvent_rdict.pcm, libEvent.rootmap
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E env LD_LIBRARY_PATH=/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib:/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3python3/Tue/x86_64-centos7-gcc62-opt/lib/python3.6/site-packages/tensorflow:/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3python3/Tue/x86_64-centos7-gcc62-opt/lib/python3.6/site-packages/tensorflow/contrib/tensor_forest:/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3python3/Tue/x86_64-centos7-gcc62-opt/lib/python3.6/site-packages/tensorflow/python/framework:/cvmfs/sft.cern.ch/lcg/releases/java/8u91-ae32f/x86_64-centos7-gcc62-opt/jre/lib/amd64:/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3python3/Tue/x86_64-centos7-gcc62-opt/lib64:/cvmfs/sft-nightlies.cern.ch/lcg/views/dev3python3/Tue/x86_64-centos7-gcc62-opt/lib:/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/lib:/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/lib64:/cvmfs/sft.cern.ch/lcg/releases/binutils/2.28-a983d/x86_64-centos7/lib:/cvmfs/sft.cern.ch/lcg/views/LCG_92python3/x86_64-centos7-gcc62-opt/lib64:/cvmfs/sft.cern.ch/lcg/views/LCG_92python3/x86_64-centos7-gcc62-opt/lib:/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/lib:/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/lib64:/cvmfs/sft.cern.ch/lcg/releases/binutils/2.28-a983d/x86_64-centos7/lib /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/bin/rootcling -v2 -f G__Event.cxx -s /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/libEvent.so -rml libEvent.so -rmf /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/libEvent.rootmap -I/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/include -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include/torch/csrc/api/include /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/Event.h /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/EventLinkDef.h
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Event.dir/DependInfo.cmake --color=
Dependee "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Event.dir/DependInfo.cmake" is newer than depender "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Event.dir/depend.internal".
Dependee "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Event.dir/depend.internal".
Scanning dependencies of target Event
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
make -f CMakeFiles/Event.dir/build.make CMakeFiles/Event.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
[ 33%] Building CXX object CMakeFiles/Event.dir/Event.cxx.o
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++  -DEvent_EXPORTS -I/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/include -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event -isystem /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include -isystem /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include/torch/csrc/api/include  -std=c++14 -pipe -fsigned-char -pthread -fPIC    -std=c++14 -pipe -fsigned-char -pthread -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -std=gnu++1z -o CMakeFiles/Event.dir/Event.cxx.o -c /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/Event.cxx
[ 50%] Building CXX object CMakeFiles/Event.dir/G__Event.cxx.o
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++  -DEvent_EXPORTS -I/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/include -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event -isystem /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include -isystem /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include/torch/csrc/api/include  -std=c++14 -pipe -fsigned-char -pthread -fPIC    -std=c++14 -pipe -fsigned-char -pthread -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -std=gnu++1z -o CMakeFiles/Event.dir/G__Event.cxx.o -c /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/G__Event.cxx
[ 66%] Linking CXX shared library libEvent.so
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_link_script CMakeFiles/Event.dir/link.txt --verbose=1
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++ -fPIC   -std=c++14 -pipe -fsigned-char -pthread  -shared -Wl,-soname,libEvent.so -o libEvent.so CMakeFiles/Event.dir/Event.cxx.o CMakeFiles/Event.dir/G__Event.cxx.o  -L/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib -Wl,-rpath,/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libtorch.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libImt.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRIO.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libNet.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libHist.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf3d.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGpad.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libROOTDataFrame.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTree.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTreePlayer.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRint.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPostscript.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMatrix.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPhysics.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMathCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libThread.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMultiProc.so -Wl,--no-as-needed,/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libcaffe2.so -Wl,--as-needed /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libc10.so -lpthread 
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
[ 66%] Built target Event
make -f CMakeFiles/Main.dir/build.make CMakeFiles/Main.dir/depend
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
cd /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_depends "Unix Makefiles" /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Main.dir/DependInfo.cmake --color=
Dependee "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Main.dir/DependInfo.cmake" is newer than depender "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Main.dir/depend.internal".
Dependee "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build/CMakeFiles/Main.dir/depend.internal".
Scanning dependencies of target Main
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
make -f CMakeFiles/Main.dir/build.make CMakeFiles/Main.dir/build
make[2]: Entering directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
[ 83%] Building CXX object CMakeFiles/Main.dir/MainEvent.cxx.o
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++   -I/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/include -I/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event -isystem /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include -isystem /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/include/torch/csrc/api/include  -std=c++14 -pipe -fsigned-char -pthread    -std=c++14 -pipe -fsigned-char -pthread -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -std=gnu++1z -o CMakeFiles/Main.dir/MainEvent.cxx.o -c /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/MainEvent.cxx
[100%] Linking CXX executable Main
/cvmfs/sft.cern.ch/lcg/releases/CMake/3.11.1-daf3a/x86_64-centos7-gcc62-opt/bin/cmake -E cmake_link_script CMakeFiles/Main.dir/link.txt --verbose=1
/cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-centos7/bin/g++    -std=c++14 -pipe -fsigned-char -pthread  -rdynamic CMakeFiles/Main.dir/MainEvent.cxx.o  -o Main  -L/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib -Wl,-rpath,/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build:/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib libEvent.so /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libtorch.so -Wl,--no-as-needed,/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libcaffe2.so -Wl,--as-needed /terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/lib/libtorch/lib/libc10.so -lpthread /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libImt.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRIO.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libNet.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libHist.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf3d.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGpad.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libROOTDataFrame.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTree.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTreePlayer.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRint.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPostscript.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMatrix.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPhysics.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMathCore.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libThread.so /cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMultiProc.so 
libEvent.so: undefined reference to `TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::vector<std::pair<std::string, int>, std::allocator<std::pair<std::string, int> > > const&, char const**, bool)'
collect2: error: ld returned 1 exit status
make[2]: *** [Main] Errore 1
make[2]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
make[1]: *** [CMakeFiles/Main.dir/all] Errore 2
make[1]: Leaving directory `/terabig/amiucci/LoopSUSYFrame_rel21/LoopSUSYFrame/example/event/build'
make: *** [all] Errore 2

It looks like there is some inter-dependency in between libtorch and ROOT, and it is important to take care of those. My question is: how should I write my CMakeLists.txt to take care of this kind of dependancy in a proper way?

I already tried to swap the order of the target_link_libraries, but this ha snot helped, also to swap them in the include. So there is some general practice I am missing, lacking in experience with the cmake tool.

I am also trying to build my own Makefile, but there I have issues with libtorch at the moment.

Any support will be very appreciated.

Thanks a lot,
Antonello.

Try adding ROOTDataFrame to the required components

I tried, unfortunately did not solve the issue. The same error is popping up.

But isn’t this a different error? You are getting undefined references to TROOT::RegisterModule, not to RDataFrame stuff. You need to tell CMake to link the library that defines it.

Try adding Core to the required components too.

Yes, it is a different error, but it is a completely different file, which I made as another example. Just to test cmake compilation with libtorch from the root example provided.

I tried to add Core so that
find_package(ROOT REQUIRED COMPONENTS Core MathCore RIO Hist Tree Net)

the issue is still there.

My understanding is there there is a problem with the linking order of the libraries. But I do not know how to overcome it.

It’s the target_link_libraries: it tells CMake what libraries you need to link to generate the executable. What are you passing to it? What does ${ROOT_LIBRARIES} contain?

(you also need to add all the libraries you need to ROOT’s required components, so ROOTDataFrame and Core go there in all cases)

Hi Enrico,

for the example I do not need ROOTDataFrame and for LoopSUSYFrame I already tested that even without specifying the components the compilation is fine and the code runs.

Coming back to your question, this is the output of the ${ROOT_LIBRARIES} and ${TORCH_LIBRARIES}:

ROOT_LIBRARIES:/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libCore.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libImt.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRIO.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libNet.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libHist.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGraf3d.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libGpad.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libROOTDataFrame.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTree.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libTreePlayer.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libRint.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPostscript.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMatrix.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libPhysics.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMathCore.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libThread.so/cvmfs/sft-nightlies.cern.ch/lcg/nightlies/dev3python3/Tue/ROOT/HEAD/x86_64-centos7-gcc62-opt/lib/libMultiProc.so
TORCH_LIBRARIES:torchcaffe2_library