Error when passing parameters into custom RDataFrame column

Hi,

I am running into an error when trying to pass parameters into a function to define a custom column in my RDataFrame. I am able to use the function if I edit it to work with no input parameters, but run into the following error during make when I try to pass anything in:

make -j4
**Scanning dependencies of target hhbbyy**
[ 8%] Building CXX object CMakeFiles/hhbbyy.dir/src/OverlapDumper.cxx.o
[ 16%] **Linking CXX executable ../run/hhbbyy**
/cvmfs/sft.cern.ch/lcg/releases/binutils/2.30-e5b21/x86_64-centos7/bin/ld: CMakeFiles/hhbbyy.dir/src/OverlapDumper.cxx.o: undefined reference to symbol '_ZN4ROOT6VecOps4RVecIfEC1Ev'
/cvmfs/atlas.cern.ch/repo/sw/software/21.2/AnalysisBaseExternals/21.2.149/InstallArea/x86_64-centos7-gcc8-opt/lib/libROOTVecOps.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [../run/hhbbyy] Error 1
make[1]: *** [CMakeFiles/hhbbyy.dir/all] Error 2
make: *** [all] Error 2

The following is a simple snippet of what I am trying to do:

std::vector<int> build_regions(const Float_t& m_yy)
{
  std::vector<int> regions;
  if (m_yy > 1) {
    regions = {1500, 1501};
  }
  else {
    regions = {1503};
  }
  return regions;
}

ROOT::RDF::RNode df_with_defines(df_out);
df_with_defines = df_with_defines.Define("region", build_regions, {"HGamEventInfoAuxDyn.m_yy"});

Is there anything obviously wrong how I am passing in the “HGamEventInfoAuxDyn.m_yy” column?

Thank you,

Jannicke

ROOT Version: 6.20/06
Platform: lxplus
Built for linuxx8664gcc
Using asetup 21.2.149,AnalysisBase

Hi @jpearkes,
that is not a compilation error, i.e. your code is fine.
It’s a linker error, so probably there is something missing in your makefile. The missing symbol is _ZN4ROOT6VecOps4RVecIfEC1Ev (which via c++filt demangles to ROOT::VecOps::RVec<float>::RVec()). You are probably not linking libROOTVecOps: maybe just add -lROOTVecOps to the compiler invocation?

Cheers,
Enrico

Hi Enrico,

Thank you for the speedy reply! I am not 100% sure how to add -lROOTVecOps to the compiler invocation. I tried adding set(CMAKE_CXX_FLAGS “-lROOTVecOps”) to my CMakeLists.txt, but I get the following error when I do that… so I guess it might not be correct. Would it be possible for you to explain in a little more detail?

/cvmfs/sft.cern.ch/lcg/releases/binutils/2.30-e5b21/x86_64-centos7/bin/ld: cannot find -lROOTVecOps
collect2: error: ld returned 1 exit status

I have attached the full CMakeLists.txt just in case it helps.

Thanks again,

Jannicke

CMakeLists.txt (2.1 KB)

Ah it’s cmake! I thought it was a plain makefile. Then you add it to target_link_libraries, e.g. target_link_libraries(hhbbyy ${ROOT_LIBRARIES} ROOTVecOps).

Cheers,
Enrico

Thanks for the quick reply! Deleting everything in my build directory and rerunning cmake and make, I still seem to be getting the same error as before. I’ve double checked that the CMakeLists.txt file was updated with target_link_libraries(hhbbyy ${ROOT_LIBRARIES} ROOTVecOps), and am not sure what to check next.

[100%] **Linking CXX executable ../run/hhbbyy**
/cvmfs/sft.cern.ch/lcg/releases/binutils/2.30-e5b21/x86_64-centos7/bin/ld: cannot find -lROOTVecOps
collect2: error: ld returned 1 exit status
make[2]: *** [../run/hhbbyy] Error 1
make[1]: *** [CMakeFiles/hhbbyy.dir/all] Error 2
make: *** [all] Error 2

Let’s check the actual compilation command given: you can use e.g. make VERBOSE=1 rather than just make. Please post the full output here.

Thanks for the help. Attached is the full output with VERBOSE = 1
make_output.txt (5.2 KB)

Uhm can you please try ROOT::VecOps instead of ROOTVecOps?

Updating to target_link_libraries(hhbbyy ${ROOT_LIBRARIES} ROOT::VecOps) results in an error at the cmake step instead of the make one.

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-centos7/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-centos7/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Error at CMakeLists.txt:21 (add_executable):
  Target "hhbbyy" links to target "ROOT::VecOps" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Mmmh weird, is there a public repo with code and cmake files that I can check?

Also what ROOT version do you have installed?

ROOT::ROOTVecOps

Actually, “-lROOTVecOps” should automatically appear in the output of “root-config --libs” (well, probably unless there is no “veccore” among “root-config --features”) so, it should not be needed to add it again. @Axel If it does not automatically appear also in “ROOT_LIBRARIES” then for me it is a bug in “ROOTConfig.cmake”.

@oshadura do you agree? Should we open a Github issue? Or can you just fix it?

In ROOT v6.22.06 -lROOTVecOps is part of root-config --libs.

Also note that veccore is only an optional requirement of libROOTVecOps.

I’m not 100% sure what the problem is with @jpearkes 's cmake project, I would like to take a look at the repository.

The “make_output.txt” file, present in one of the previous posts above, suggests that “libROOTVecOps” was not present in “ROOT_LIBRARIES” (which originates from “ROOTConfig.cmake”, I guess).

For whatever reason, all ROOT libraries were hardcoded with “-Wl,-rpath,/.../lib” and then adding “-lROOTVecOps” did not work (maybe adding ROOT::ROOTVecOps to target_link_libraries would do the job, though).

Hi Enrico,

Sorry for the slow reply, as mentioned in my first post I am using ROOT 6.20/06. Unfortunately the code isn’t public, which makes things complicated to replicate.

Wile_E_Coyote’s suggestion of adding ROOT::ROOTVecOps to target_link_libraries seems to have worked though! Thanks for the help!

Hi Wile_E_Coyote,

Adding ROOT::ROOTVecOps to target_link_libraries worked, thank you very much!

1 Like

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

This is still unsolved in ROOT 6.22/08.

Hi @Wile_E_Coyote ,
can you please open a GitHub issue about the problem?

Cheers,
Enrico