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.
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).
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.
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.
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”.
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).
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!