CMake Linking RDataFrame (6.16.00)

Hi All,

I am again having issues with RDataFrame and CMake, a number of warnings indicating that linking is attempting to use the ROOT build path:

-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: /opt/x86_64-pc-linux-gnu-rhel6/gcc/8.1.0/bin/gcc
-- Check for working C compiler: /opt/x86_64-pc-linux-gnu-rhel6/gcc/8.1.0/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: /opt/x86_64-pc-linux-gnu-rhel6/gcc/8.1.0/bin/g++
-- Check for working CXX compiler: /opt/x86_64-pc-linux-gnu-rhel6/gcc/8.1.0/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- RDataFrame Enabled
-- Configuring done
CMake Warning at CMakeLists.txt:27 (add_executable):
  Cannot generate a safe linker search path for target rdf_test because files
  in some directories may conflict with libraries in implicit directories:

    link library [libCore.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libImt.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libRIO.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libNet.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libHist.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libGraf.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libGraf3d.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libGpad.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libROOTDataFrame.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libTree.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libTreePlayer.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libRint.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libPostscript.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libMatrix.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libPhysics.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libMathCore.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libThread.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
    link library [libMultiProc.so] in /opt/root/gcc_8.1.0/6.16.00/install/lib may be hidden by files in:
      /opt/root/gcc_8.1.0/6.16.00/build/lib
      
  Some of these libraries may not be found correctly.

... (Warning repeats)

-- Generating done
-- Build files have been written to: rdataframe_cmake_test/build

The path variables are set to the ROOT install directory and root-config returns the install directory for the prefix.

MWE CMake file:

cmake_minimum_required(VERSION 3.0)

#Find the ROOT package.
find_package(ROOT 6 REQUIRED)

option(RDataFrame "Use RDataFrame for analysis." ON)

#If the user requests RDataFrame then ROOT 6.14 is required with the RootDataFrame library.
if (${RDataFrame})
        find_package(ROOT 6.14 REQUIRED COMPONENTS ROOTDataFrame)
        message(STATUS "RDataFrame Enabled")
endif (${RDataFrame})

add_executable(rdf_test rdf_test.cxx)
target_link_libraries(rdf_test PUBLIC ${ROOT_LIBRARIES})
set_target_properties(rdf_test PROPERTIES INSTALL_RPATH "${ROOT_LIBRARY_DIR}")
if (${RDataFrame})
        target_link_libraries(rdf_test PUBLIC ROOT::ROOTDataFrame)
        target_compile_definitions(rdf_test PUBLIC USE_RDataFrame)
endif (${RDataFrame})

The dummy program:

#ifdef USE_RDataFrame
#include <ROOT/RDataFrame.hxx>
#endif

int main() {
        return 0;
}

This post follows from a previous one:

Any help is appreciated.


ROOT Version: 6.16.00
Platform: RHEL 6
Compiler: gcc 8.1.0 (cmake 3.10.3)


What happens if you replace ${ROOT_LIBRARIES} with ROOT::ROOTDataFrame?

Why do you set this? Can you print the value of that variable?

One instance of the warning vanishes, otherwise it is the same.

This is set in an attempt to allow executables built with a certain version to run without the environment being set for that version of ROOT, preferring to use RPATH over LD_LIBRARY_PATH. We have a large number of versions installed on these shared machines and users may have arbitrary versions loaded in their environment. We are trying to avoid building executables for every possible ROOT version installed. The variable returns this:

/opt/root/gcc_8.1.0/6.16.00/install/lib

If you have ROOTSYS set it may be messing your environment. Did you source a thisroot.sh prior to running your CMake build? Did you configure ROOT installed at /opt/... with that install path, or did you relocate ROOT into there?

ROOTSYS is set to /opt/root/gcc_8.1.0/6.16.00/install/lib

We do not use the thisroot.sh files, but instead have environment modules as below:

#%Module1.0
##
## root modulefile
##

set version 6.16.00

proc ModulesHelp {} {
   global version
   puts stderr "ROOT ${version} - Modular scientific software framework.\n"
}

module-whatis "Loads the CERN ROOT ${version} scientific framework."

conflict root

if [is-loaded gcc/8.1.0] {
        set gcc_version "8.1.0"
        prereq gcc/8.1.0
} elseif [is-loaded gcc/6.3.0] {
        set gcc_version "6.3.0"
        prereq gcc/6.3.0
} else {
        module load gcc/8.1.0
        set gcc_version "8.1.0"
}

set prefix /opt/root/gcc_${gcc_version}/${version}/install
setenv ROOTSYS ${prefix}
prepend-path LIBRARY_PATH ${prefix}/lib
prepend-path PYTHONPATH ${prefix}/lib
prepend-path CMAKE_PREFIX_PATH ${prefix}
prepend-path JUPYTER_PATH ${prefix}/etc/notebook
prepend-path PATH ${prefix}/bin

# Required for Juypter and auto inspection of third-party libraries.
prepend-path LD_LIBRARY_PATH ${prefix}/lib
prepend-path DYLD_LIBRARY_PATH ${prefix}/lib

#MANPATH is typically automatically deduced from the PATH. This automatic search
# is disabled if MANPATH is set and can cause system manual pages to be
# unavailable.
#append-path MANPATH ${prefix}/man 

In addition, I’ve searched the environment for the word ‘build’ which does not appear using:

printenv | grep build

We pass the install directory to cmake via CMAKE_INSTALL_PREFIX and allow it to place the files in /opt.

I think it’s possible that you have the build directory in your LD_LIBRARY_PATH. I’d inspect your environment variables to see what could be causing the problem. It doesn’t seem like ROOT is to blame here.

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