TClass::GetClass linker error

Hello,

When we’re compiling our shared library (including ROOT dictionaries) we’re getting this compiler error on one system that we can’t reproduce on another system. Do you have any idea why this might be happening. The same dictionary generating cmake and linking code (nothing fancy) works on multiple other systems. ROOT is built from source on mac, but also we get this error on that machine with ROOT from macports.

Any hints would be appreciated.

Cheers,
Laurie

[ 94%] Linking CXX shared library librebdsim.dylib
cd /Users/ben/installs/bdsim/1.5.1-develop/build/analysis && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/rebdsim.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe -Qunused-arguments -DGL_SILENCE_DEPRECATION -stdlib=libc++ -O2 -g -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -dynamiclib -Wl,-headerpad_max_install_names -o librebdsim.dylib -install_name @rpath/librebdsim.dylib CMakeFiles/rebdsim.dir/Analysis.cc.o CMakeFiles/rebdsim.dir/AnalysisUtilities.cc.o CMakeFiles/rebdsim.dir/Beam.cc.o CMakeFiles/rebdsim.dir/BeamAnalysis.cc.o CMakeFiles/rebdsim.dir/BinGeneration.cc.o CMakeFiles/rebdsim.dir/BinLoader.cc.o CMakeFiles/rebdsim.dir/Config.cc.o CMakeFiles/rebdsim.dir/DataLoader.cc.o CMakeFiles/rebdsim.dir/Event.cc.o CMakeFiles/rebdsim.dir/EventAnalysis.cc.o CMakeFiles/rebdsim.dir/EventAnalysisOrbit.cc.o CMakeFiles/rebdsim.dir/FileMapper.cc.o CMakeFiles/rebdsim.dir/Header.cc.o CMakeFiles/rebdsim.dir/HeaderAnalysis.cc.o CMakeFiles/rebdsim.dir/HistogramAccumulator.cc.o CMakeFiles/rebdsim.dir/HistogramAccumulatorMerge.cc.o CMakeFiles/rebdsim.dir/HistogramAccumulatorSum.cc.o CMakeFiles/rebdsim.dir/HistogramDef.cc.o CMakeFiles/rebdsim.dir/HistogramDef1D.cc.o CMakeFiles/rebdsim.dir/HistogramDef2D.cc.o CMakeFiles/rebdsim.dir/HistogramDef3D.cc.o CMakeFiles/rebdsim.dir/HistogramFactory.cc.o CMakeFiles/rebdsim.dir/HistogramMeanFromFile.cc.o CMakeFiles/rebdsim.dir/Model.cc.o CMakeFiles/rebdsim.dir/ModelAnalysis.cc.o CMakeFiles/rebdsim.dir/Options.cc.o CMakeFiles/rebdsim.dir/OptionsAnalysis.cc.o CMakeFiles/rebdsim.dir/ParticleData.cc.o CMakeFiles/rebdsim.dir/PerEntryHistogram.cc.o CMakeFiles/rebdsim.dir/Run.cc.o CMakeFiles/rebdsim.dir/RunAnalysis.cc.o CMakeFiles/rebdsim.dir/SamplerAnalysis.cc.o CMakeFiles/rebdsim.dir/SelectionLoader.cc.o CMakeFiles/rebdsim.dir/AnalysisUtilitiesDict.cc.o CMakeFiles/rebdsim.dir/BeamAnalysisDict.cc.o CMakeFiles/rebdsim.dir/BeamDict.cc.o CMakeFiles/rebdsim.dir/BinSpecificationDict.cc.o CMakeFiles/rebdsim.dir/ConfigDict.cc.o CMakeFiles/rebdsim.dir/DataLoaderDict.cc.o CMakeFiles/rebdsim.dir/EventAnalysisDict.cc.o CMakeFiles/rebdsim.dir/EventAnalysisOrbitDict.cc.o CMakeFiles/rebdsim.dir/EventDict.cc.o CMakeFiles/rebdsim.dir/HeaderDict.cc.o CMakeFiles/rebdsim.dir/HistogramAccumulatorDict.cc.o CMakeFiles/rebdsim.dir/HistogramAccumulatorMergeDict.cc.o CMakeFiles/rebdsim.dir/HistogramAccumulatorSumDict.cc.o CMakeFiles/rebdsim.dir/HistogramDef1DDict.cc.o CMakeFiles/rebdsim.dir/HistogramDef2DDict.cc.o CMakeFiles/rebdsim.dir/HistogramDef3DDict.cc.o CMakeFiles/rebdsim.dir/HistogramDefDict.cc.o CMakeFiles/rebdsim.dir/HistogramFactoryDict.cc.o CMakeFiles/rebdsim.dir/HistogramMeanFromFileDict.cc.o CMakeFiles/rebdsim.dir/ModelAnalysisDict.cc.o CMakeFiles/rebdsim.dir/ModelDict.cc.o CMakeFiles/rebdsim.dir/OptionsAnalysisDict.cc.o CMakeFiles/rebdsim.dir/OptionsDict.cc.o CMakeFiles/rebdsim.dir/ParticleDataDict.cc.o CMakeFiles/rebdsim.dir/PerEntryHistogramDict.cc.o CMakeFiles/rebdsim.dir/RunAnalysisDict.cc.o CMakeFiles/rebdsim.dir/RunDict.cc.o CMakeFiles/rebdsim.dir/SamplerAnalysisDict.cc.o  -L/Users/ben/installs/bdsim/1.5.1-develop/bdsim/parser -L/Users/ben/installs/bdsim/1.5.1-develop/bdsim/src-external -Wl,-rpath,/opt/local/libexec/root6/lib/root -Wl,-rpath,/Users/ben/installs/bdsim/1.5.1-develop/bdsim/parser -Wl,-rpath,/Users/ben/installs/bdsim/1.5.1-develop/bdsim/src-external -Wl,-rpath,/Users/ben/installs/bdsim/1.5.1-develop/build ../libbdsimRootEvent.1.5.develop.dylib -L/opt/local/libexec/root6/lib/root -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/opt/local/libexec/root6/lib/root -lpthread -lm -ldl 
Undefined symbols for architecture x86_64:
 "TClass::GetClass(std::type_info const&, bool, bool)", referenced from:
   EventAnalysisOrbit::WriteOrbit(TFile*) in EventAnalysisOrbit.cc.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]: *** [analysis/librebdsim.dylib] Error 1
make[1]: *** [analysis/CMakeFiles/rebdsim.dir/all] Error 2
make: *** [all] Error 2

ROOT Version: 6.24/00
Built for macosx64 on May 07 2021, 10:08:00
root-config --features
cxx11 asimage builtin_afterimage builtin_clang builtin_cling builtin_freetype builtin_ftgl builtin_glew builtin_llvm builtin_nlohmannjson builtin_openui5 clad cocoa dataframe davix exceptions fftw3 gdml http imt libcxx mathmore mlp opengl pyroot roofit shared sqlite ssl tmva tmva-cpu tmva-pymva spectrum vdt xml xrootd

Platform: Mac OSX 11.3.1
Compiler: Apple clang version 12.0.5 (clang-1205.0.22.9) Target: x86_64-apple-darwin20.4.0


I am not sure what is causing this problem. May be @Axel or @oshadura have an idea.

My guess:

/opt/local/libexec/root6/lib/root/libCore.so doesn’t correspond to the header that was used to build EventAnalysisOrbit.cc.o, either because the include path (-I) was pointing to a different ROOT, or because you have updated ROOT without rebuilding EventAnalysisOrbit.cc.o.

Did I guess correctly? :wink:

Hello - thanks for the hint!

Managed to resolve it. So there were some files left over from an old ROOT installation in /usr/local. These were inadvertently included via -I /usr/local/lib/CLHEP-2.4.4.1/…/…/include which came before the include for ROOT. We removed these old files and it works fine now! Whew.

Thank you, Laurie.

1 Like

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