ROOT 6.14 with cmake build system

ROOT Version: 6.14
Platform: mac os
Compiler: clang

I managed to build ROOT 6.14 on Mac but still experience some issues. I updated to the latest version of python and xcode tools.

In python ROOT works. So does the interactive ROOT version. Also the new RDataFrame features work in interactive ROOT. Then I tried to use the new RDataFrame and if I link it in cmake the same way I did for previous ROOT versions I get an error:

Scanning dependencies of target root_intro
[ 50%] Building CXX object CMakeFiles/root_intro.dir/src/main.cpp.o
[100%] Linking CXX executable ../bin/root_intro
Undefined symbols for architecture x86_64:
  "ROOT::RDataFrame::RDataFrame(std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)", referenced from:
      _main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [CMakeFiles/root_intro.dir/build.make:112: ../bin/root_intro] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:68: CMakeFiles/root_intro.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/root_intro.dir/rule] Error 2
gmake: *** [Makefile:118: root_intro] Error 2

I assume there’s something missing in the linking (CMakeLists.txt) of the new ROOT features to cmake but I couldn’t find anything on the web. Ok maybe also I’m missing some header files. Not sure. I attached the minimal example to the post. So any ideas are welcome.

CMakeLists.txt (1.9 KB)
main.cpp (136 Bytes)

Hey, thanks. Yes indeed adding:


to cmake file worked. But I’m wondering if there is any cleaner solution so one doesn’t have to include each header file in use to cmake file by hand. For example:

find_package(ROOT REQUIRED )


target_link_libraries(${PROJECT_NAME} ${ROOT_LIBRARIES})

links all ‘old’ ROOT header files. Is there something similar for the ‘new’ part.

@brencic This has been fixed on master and v6-14-00-patches branches. Thanks for reporting!

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