CMAKE example failing to link for ROOT v5.34.34 MacOSX10.10

Hi,

I am attempting the CMAKE example from the FAQ at root.cern.ch/faq/can-i-integrat … make-build.

I am using ROOTv5.34.34 on Mac OS X 10.10.

When I execute “cmake …” everything seems fine. Then “make” results in:

[code][ 16%] Generating G__Event.cxx, G__Event_rdict.pcm, libEvent.rootmap
Scanning dependencies of target Event
[ 33%] Building CXX object CMakeFiles/Event.dir/Event.cxx.o
[ 50%] Building CXX object CMakeFiles/Event.dir/G__Event.cxx.o
[ 66%] Linking CXX shared library libEvent.dylib
Undefined symbols for architecture x86_64:
“ROOT::Class_ShowMembers(TClass*, void const*, TMemberInspector&)”, referenced from:
Track::ShowMembers(TMemberInspector&) const in Event.cxx.o
Event::ShowMembers(TMemberInspector&) const in Event.cxx.o
HistogramManager::ShowMembers(TMemberInspector&) const in Event.cxx.o
EventHeader::ShowMembers(TMemberInspector&) const in G__Event.cxx.o
"ROOT::TGenericClassInfo::TGenericClassInfo(char const*, int, char const*, int, std::type_info const&, ROOT::Internal::TInitBehavior const*, TClass* ()(), TVirtualIsAProxy, int, int)", referenced from:
ROOT::GenerateInitInstanceLocal(EventHeader const*) in G__Event.cxx.o
ROOT::GenerateInitInstanceLocal(Event const*) in G__Event.cxx.o
ROOT::GenerateInitInstanceLocal(HistogramManager const*) in G__Event.cxx.o
ROOT::GenerateInitInstanceLocal(Track const*) in G__Event.cxx.o
"ROOT::Internal::DefineBehavior(void*, void*)", referenced from:
ROOT::GenerateInitInstanceLocal(EventHeader const*) in G__Event.cxx.o
ROOT::GenerateInitInstanceLocal(Event const*) in G__Event.cxx.o
ROOT::GenerateInitInstanceLocal(HistogramManager const*) in G__Event.cxx.o
ROOT::GenerateInitInstanceLocal(Track const*) in G__Event.cxx.o
"TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, int>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, int> > > const&, char const**)", referenced from:
(anonymous namespace)::TriggerDictionaryInitialization_G__Event_Impl() in G__Event.cxx.o
"TStorage::ObjectAllocArray(unsigned long)", referenced from:
TObject::operator new[](unsigned long) in G__Event.cxx.o
"_gInterpreterMutex", referenced from:
EventHeader::Class() in G__Event.cxx.o
Event::Class() in G__Event.cxx.o
HistogramManager::Class() in G__Event.cxx.o
Track::Class() in G__Event.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libEvent.dylib] Error 1
make[1]: *** [CMakeFiles/Event.dir/all] Error 2
make: *** [all] Error 2

This example succeeded when I used ROOT6. Why is it not working for ROOT5?

Thanks in advance,
Tom

Hi Tom,

I think I know. In ROOT 6 I did add all the ‘standard’ libraries by default when you do find_package(ROOT). This is not the case for ROOT 5 for the time being (I plan to do it also for next patch release). So, if you simply change the line with

find_package(ROOT REQUIRED COMPONENTS RIO Net Hist Graf Graf3d Gpad Tree Rint Postscript Matrix Physics MathCore Thread)

will probably work.

Pere

Hi Pere,

I tried your suggestion, and it still failed the same way. I believe the example is already trying to add the appropriate libraries explicitly via the find_package method.

If I add nothing I see no statement that ROOT was found.

If I add to the CMakeLists.txt

I get:
– The C compiler identification is AppleClang 7.0.2.7000181
– The CXX compiler identification is AppleClang 7.0.2.7000181
– Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
– Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc – 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
– Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found ROOT: /Users/tcarroll/Products/root/bin/root-config
CMake Error at CMakeLists.txt:15 (include):
include called with wrong number of arguments. include() only takes one
file.

– Configuring incomplete, errors occurred!

So then I comment out in CMakeLists.txt

and cmake, make and executing Main all go fine.

Whats going on here?

Is

# 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

asking me to set the CMAKE_MODULE_PATH?

-Tom

Did you build v5.34.34 with CMake? If this is the case you do not need to add set(CMAKE_MODULE_PATH $ENV{ROOTSYS}/etc/cmake) since it crates a ROOTConfig.cmake in $ROOTSYS.

No, I used the older style of first running configure then make.

-Tom