Problem linking shared library on MacOS

Dear experts,
I opened this thread before:

The problem was not solved.
I reinstalled the root from scratch.
Now I have root:

ROOT Version: 6.31/01
Built for macosx64 on Apr 02 2024, 07:12:29
From heads/master@62a7ea31

Yet I am having the same problem with linking the shared libraries.

A simple test case is kept here:

I am making the repository using cmake on my Mac:
inside the test repository:

  1. mkdir build
  2. cd build
  3. cmake ../ -DCMAKE_CXX_STANDARD=17
  4. cmake --build . --verbose

This is the verbose message during compilation:

/usr/local/Cellar/cmake/3.25.0/bin/cmake -S/Users/arkasantra/tmp/test -B/Users/arkasantra/tmp/test/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_progress_start /Users/arkasantra/tmp/test/build/CMakeFiles /Users/arkasantra/tmp/test/build//CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/G__LUXESimEventDict.dir/build.make CMakeFiles/G__LUXESimEventDict.dir/depend
[ 33%] Generating G__LUXESimEventDict.cxx, libLUXESimEventDict_rdict.pcm, libLUXESimEventDict.rootmap
/usr/local/Cellar/cmake/3.25.0/bin/cmake -E env DYLD_LIBRARY_PATH=/Users/arkasantra/Root6_Install/lib:/usr/X11R6/lib:/Users/arkasantra/ACTSTracking/build/lib:/Users/arkasantra/opt/anaconda3/lib:/usr/local/lib:/Users/arkasantra/Geant4_Install/lib:/Users/arkasantra/Root6_Install/lib:/Users/arkasantra/Allpix2/version2_Allpix2/allpix-squared/lib:/Users/arkasantra/pythia8311/lib:/Users/arkasantra/ExRootAnalysis:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib:/Users/arkasantra/LHAPDF6_Build/lib:/Users/arkasantra/FastJet3_Build/lib:/Users/arkasantra/YODA_Build/lib:/Users/arkasantra/ACTSTracking/install/lib:/Users/arkasantra/Root6_Install/lib /Users/arkasantra/Root6_Install/bin/rootcling -v2 -f G__LUXESimEventDict.cxx -s /Users/arkasantra/tmp/test/build/libLUXESimEventDict.dylib -rml libLUXESimEventDict.dylib -rmf /Users/arkasantra/tmp/test/build/libLUXESimEventDict.rootmap -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/c++/v1 -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/arkasantra/tmp/test -I/Users/arkasantra/tmp/test /Users/arkasantra/tmp/test/dummy.h /Users/arkasantra/tmp/test/LinkDef.h
cd /Users/arkasantra/tmp/test/build && /usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/DependInfo.cmake --color=
Dependee "/Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/DependInfo.cmake" is newer than depender "/Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/depend.internal".
Dependee "/Users/arkasantra/tmp/test/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/depend.internal".
Scanning dependencies of target G__LUXESimEventDict
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/G__LUXESimEventDict.dir/build.make CMakeFiles/G__LUXESimEventDict.dir/build
[ 66%] Building CXX object CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -I/Users/arkasantra/tmp/test -isystem /Users/arkasantra/Root6_Install/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -fPIC -std=gnu++17 -MD -MT CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o -MF CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o.d -o CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o -c /Users/arkasantra/tmp/test/build/G__LUXESimEventDict.cxx
[ 66%] Built target G__LUXESimEventDict
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/LUXESimEventDict.dir/build.make CMakeFiles/LUXESimEventDict.dir/depend
cd /Users/arkasantra/tmp/test/build && /usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build/CMakeFiles/LUXESimEventDict.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/LUXESimEventDict.dir/build.make CMakeFiles/LUXESimEventDict.dir/build
[100%] Linking CXX shared library libLUXESimEventDict.dylib
/usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_link_script CMakeFiles/LUXESimEventDict.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -dynamiclib -Wl,-headerpad_max_install_names -L/usr/local/opt/qt@5/lib -o libLUXESimEventDict.dylib -install_name @rpath/libLUXESimEventDict.dylib CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o
Undefined symbols for architecture x86_64:
  "Fatal(char const*, char const*, ...)", referenced from:
      ROOT::Detail::TCollectionProxyInfo::Iterators<std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, false>::next(void*, void const*) in G__LUXESimEventDict.cxx.o
  "TVersionCheck::TVersionCheck(int)", referenced from:
      ___cxx_global_var_init in G__LUXESimEventDict.cxx.o
  "ROOT::AddClassAlternate(char const*, char const*)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::Class_ShowMembers(TClass*, void const*, TMemberInspector&)", referenced from:
      Dummy::ShowMembers(TMemberInspector&) const in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetNewArray(void* (*)(long, void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetDestructor(void (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::AdoptAlternate(ROOT::TClassAlt*)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetDeleteArray(void (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::GetImplFileLine()", referenced from:
      Dummy::ImplFileLine() in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::GetImplFileName()", referenced from:
      Dummy::ImplFileName() in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::AdoptCollectionProxyInfo(ROOT::Detail::TCollectionProxyInfo*)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetNew(void* (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::GetClass()", referenced from:
      Dummy::Dictionary() in G__LUXESimEventDict.cxx.o
      Dummy::Class() in G__LUXESimEventDict.cxx.o
      ROOT::vectorlEtuplelEintcOdoublegRsPgR_Dictionary() in G__LUXESimEventDict.cxx.o
      ROOT::maplEunsignedsPlongcOvectorlEtuplelEintcOdoublegRsPgRsPgR_Dictionary() in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetDelete(void (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.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(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::~TGenericClassInfo()", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::Internal::DefineBehavior(void*, void*)", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::Internal::HasConsistentHashMember(char const*)", referenced from:
      Dummy::CheckTObjectHashConsistency() const in G__LUXESimEventDict.cxx.o
  "ROOT::Internal::HasConsistentHashMember(TClass&)", referenced from:
      Dummy::CheckTObjectHashConsistency() const in G__LUXESimEventDict.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<char>, std::__1::allocator<char>>, int>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int>>> const&, char const**, bool)", referenced from:
      (anonymous namespace)::TriggerDictionaryInitialization_libLUXESimEventDict_Impl() in G__LUXESimEventDict.cxx.o
  "TIsAProxy::TIsAProxy(std::type_info const&)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "_gInterpreterMutex", referenced from:
      Dummy::Class() in G__LUXESimEventDict.cxx.o
  "_kAssertMsg", referenced from:
      ROOT::Detail::TCollectionProxyInfo::Iterators<std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, false>::next(void*, void const*) in G__LUXESimEventDict.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]: *** [libLUXESimEventDict.dylib] Error 1
make[1]: *** [CMakeFiles/LUXESimEventDict.dir/all] Error 2
make: *** [all] Error 2

I will be grateful if you help me solve this issue.

Thank you,
Arka


_ROOT Version: 6.31/01
_Platform: MacOS (x86_64, Intel i9)
_Compiler: AppleClang 15.0.0.15000309


I will try locally . Which MacOS version do you have ?

Hi,
My MacOS version is 14.4.1 (23E224).
Thank you,
Arka

I tried on a similar machine with ROOT master. It installed without problem

git clone ....
mkdir build
cd build
cmake ../root
make -j8

Hi @couet ,
Thanks for checking this.
Just to clarify, you built the test repository from my Github, right?
From your commands, it looks like you built the root directory.

Anyway, root in my system still behaved weirdly.
I can run the basic root macros without any issue: but linking of libraries is giving me trouble.

This was the configuration command I used to build root on my system:

cmake -DCMAKE_INSTALL_PREFIX=/Users/arkasantra/Root6_Install -DPython3_EXECUTABLE=python3 -DPython2_EXECUTABLE=python2 -DCMAKE_CXX_STANDARD=17 -Dbuiltin_nlohmannjson=ON -Dhttp=ON -Droot7=ON -Dbuiltin_xrootd=ON -Dxrootd=ON -Dbuiltin_glew=ON /Users/arkasantra/root-6.31.01

The output of the configuration message is the following:

-- Building ROOT version 6.31.01
-- Checking internet connectivity
-- Checking internet connectivity - found
-- Looking for Python
-- Found Python3: /opt/anaconda3/bin/python3.11 (found version "3.11.7") found components: Interpreter Development NumPy Development.Module Development.Embed
-- The default C++ standard in use by the detected compiler (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++) is lower than C++17. Setting C++17 as the minimum standard.
-- Performing Test HAS_LIBCXX11
-- Performing Test HAS_LIBCXX11 - Success
-- Found a macOS system 14.4
-- Found an x86_64 system
-- ROOT default compression algorithm: zlib
-- Cannot enable cudnn without enabling cuda or tmva-gpu: cudnn is disabled.
-- Looking for ZLib
-- Building freetype version 2.12.1 included in ROOT itself
-- Looking for PCRE
-- Looking for LZMA
-- Looking for xxHash
-- Found xxHash: /usr/local/lib/libxxhash.dylib (found suitable version "0.8.2", minimum required is "0.8")
-- Looking for ZSTD
-- Looking for LZ4
-- Building AfterImage library included in ROOT itself
-- Looking for OpenGL
-- Looking for gl2ps
-- Looking for LibXml2
-- Looking for MySQL
-- Looking for SQLite
-- Looking for CFITSIO
-- Downloading and building XROOTD version 5.5.2
-- Checking for module 'davix>=0.6.4'
--   Found davix, version 0.8.5
-- Looking for TBB
-- Looking for BLAS for optional parts of TMVA
-- PyROOT: development package found. Building for version 3.11.7
-- Building LLVM in 'Release' mode.
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Found Python3: /opt/anaconda3/bin/python3.11 (found suitable version "3.11.7", minimum required is "3.0") found components: Interpreter
-- The xar file format has been deprecated: LLVM_HAVE_LIBXAR might be removed in the future.
-- Native target architecture is X86
-- Threads disabled.
-- Doxygen disabled.
-- Found ld64 - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-apple-darwin23.4.0
-- LLVM default target triple: x86_64-apple-darwin23.4.0
-- Building with -fPIC
-- Targeting X86
-- Targeting NVPTX
-- Clang version: 16.0.6
-- Host linker version: 1053.12
-- Building Cling as part of ROOT
-- Cling version (from VERSION file): ROOT_1.1~dev
-- Cling will look for C++ headers in '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/c++/v1' at runtime.
-- And if not found, will invoke: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -isysroot;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk' for them.
-- Found xxHash: /usr/local/lib/libxxhash.dylib (found version "0.8.2")
-- Found arc4random_buf in stdlib.h
CMake Warning at net/http/CMakeLists.txt:90 (MESSAGE):
  Not able to recognize SSL version 3.2.1, disable SSL


-- Distributed RDataFrame enabled
-- Looking for RapidYAML (used by RooFit)
-- Could NOT find ryml (missing: RYML_LIBRARY RYML_INCLUDE_DIR)
-- RapidYAML not found, only compiling RooFit with nlohmann-json parser
-- Found CHROME executable /Applications/Google Chrome.app/Contents/MacOS/Google Chrome major version 124
Running /Users/arkasantra/root-6.30.04/build/unix/compiledata.sh
Changing /Users/arkasantra/Root6_Build/ginclude/compiledata.h
-- ROOT Configuration

System:            Darwin-23.4.0
ROOT Platform:     macosx
ROOT Architecture: macosx64
Processor:         8 core Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (x86_64)
Build type:        Release
Install path:      /Users/arkasantra/Root6_Install
Compiler:          AppleClang 15.0.0.15000309
C++ standard:      17
Compiler flags:
 - C:                          -m64 -pipe -W -Wall -fsigned-char -fno-common -Qunused-arguments -pthread
 - C (built type specific):   -O3 -DNDEBUG
 - C++:                        -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++
 - C++ (built type specific): -O3 -DNDEBUG
Linker flags:
 - Executable:     -L/usr/local/opt/qt@5/lib -mmacosx-version-min=14.4
 - Module:         -L/usr/local/opt/qt@5/lib
 - Shared:         -L/usr/local/opt/qt@5/lib

-- Enabled support for:  asimage builtin_afterimage builtin_clang builtin_cling builtin_freetype builtin_glew builtin_llvm builtin_nlohmannjson builtin_openui5 builtin_vdt builtin_xrootd clad cocoa dataframe davix fitsio gdml http imt libcxx mysql opengl pyroot roofit webgui root7 rpath runtime_cxxmodules shared sqlite ssl tmva tmva-cpu tmva-pymva spectrum vdt xml xrootd
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/arkasantra/Root6_Build

I am puzzled because here nothing is suspicious to me.
Any lead on how to investigate the problem?

Thank you,
Arka

Oops … sorry I read to quickly I thought the issue was with ROOT itself. I just cloned your github and I tried on my Intel MacOS 12 machine and I get also errors… I must admit I do not know whats i wrong in your repo.

Hi @couet ,
Thanks for rechecking.
I also don’t know what’s going wrong in my repository.
This builds fine on a linux machine where root is sourced from CVMFS.

For example, this is what I did on my Linux machine:

source /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/user/atlasLocalSetup.sh
lsetup "views LCG_104c_ATLAS_2 x86_64-centos7-gcc11-opt"

Then I cloned my test repository and followed this:

cd test
mkdir build
cd build
cmake ../

This is the configuration message:

CMake Warning (dev) in CMakeLists.txt:
No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Check for working C compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/11.3.0-ad0f5/x86_64-centos7/bin/gcc
-- Check for working C compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/11.3.0-ad0f5/x86_64-centos7/bin/gcc - 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: /cvmfs/sft.cern.ch/lcg/releases/gcc/11.3.0-ad0f5/x86_64-centos7/bin/g++
-- Check for working CXX compiler: /cvmfs/sft.cern.ch/lcg/releases/gcc/11.3.0-ad0f5/x86_64-centos7/bin/g++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found nlohmann_json: /cvmfs/sft.cern.ch/lcg/views/LCG_104c_ATLAS_2/x86_64-centos7-gcc11-opt/lib64/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.10.5", minimum required is "3.10.5")
-- Found Vdt: /cvmfs/sft.cern.ch/lcg/views/LCG_104c_ATLAS_2/x86_64-centos7-gcc11-opt/include (found version "0.4")
-- Configuring done
-- Generating done
-- Build files have been written to: /srv01/agrp/arkas/TestTmp/test/build

After the command make, everything builds fine:

[ 33%] Generating G__LUXESimEventDict.cxx, libLUXESimEventDict_rdict.pcm, libLUXESimEventDict.rootmap
Scanning dependencies of target G__LUXESimEventDict
[ 66%] Building CXX object CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o
[ 66%] Built target G__LUXESimEventDict
Scanning dependencies of target LUXESimEventDict
[100%] Linking CXX shared library libLUXESimEventDict.so
[100%] Built target LUXESimEventDict

So it seems the problem of linking shared library is ONLY on the MacOS, not on Linux.
Best,
Arka

Hi @couet ,
Commenting here just so that the thread does not get closed.

May I know if there is any solution to the problem?
At present, I am using the docker version of the root on my Mac, which is essentially a Linux environment.
There things are working fine (as mentioned in my previous comment).

However, I will like to use root built on my Mac for operational ease.
Please let me know if you need anything else from me.

Thank you,
Arka

Did you try:

target_link_libraries(
    G__LUXESimEventDict 
    PUBLIC 
    ROOT::RIO)

or

target_link_libraries(
    G__LUXESimEventDict 
    PRIVATE 
    ROOT::RIO ROOT::Core)

Dear @pcanal,
I changed my CMakeLists.txt to:

target_link_libraries(
    G__LUXESimEventDict 
    PRIVATE 
    ROOT::RIO ROOT::Core)

but the linking is still a problem.

Here is the configuration output:

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Vdt: /Users/arkasantra/Root6_Install/include (found version "0.4")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/arkasantra/tmp/test/build

and this is the verbose output from build:

/usr/local/Cellar/cmake/3.25.0/bin/cmake -S/Users/arkasantra/tmp/test -B/Users/arkasantra/tmp/test/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_progress_start /Users/arkasantra/tmp/test/build/CMakeFiles /Users/arkasantra/tmp/test/build//CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/G__LUXESimEventDict.dir/build.make CMakeFiles/G__LUXESimEventDict.dir/depend
[ 33%] Generating G__LUXESimEventDict.cxx, libLUXESimEventDict_rdict.pcm, libLUXESimEventDict.rootmap
/usr/local/Cellar/cmake/3.25.0/bin/cmake -E env DYLD_LIBRARY_PATH=/Users/arkasantra/Root6_Install/lib:/usr/X11R6/lib:/Users/arkasantra/ACTSTracking/build/lib:/Users/arkasantra/opt/anaconda3/lib:/usr/local/lib:/Users/arkasantra/Geant4_Install/lib:/Users/arkasantra/Root6_Install/lib:/Users/arkasantra/Allpix2/version2_Allpix2/allpix-squared/lib:/Users/arkasantra/pythia8311/lib:/Users/arkasantra/ExRootAnalysis:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib:/Users/arkasantra/LHAPDF6_Build/lib:/Users/arkasantra/FastJet3_Build/lib:/Users/arkasantra/YODA_Build/lib:/Users/arkasantra/ACTSTracking/install/lib:/Users/arkasantra/Root6_Install/lib /Users/arkasantra/Root6_Install/bin/rootcling -v2 -f G__LUXESimEventDict.cxx -s /Users/arkasantra/tmp/test/build/libLUXESimEventDict.dylib -rml libLUXESimEventDict.dylib -rmf /Users/arkasantra/tmp/test/build/libLUXESimEventDict.rootmap -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include/c++/v1 -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include -compilerI/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/include -compilerI/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Users/arkasantra/tmp/test -I/Users/arkasantra/tmp/test /Users/arkasantra/tmp/test/dummy.h /Users/arkasantra/tmp/test/LinkDef.h
cd /Users/arkasantra/tmp/test/build && /usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/DependInfo.cmake --color=
Dependee "/Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/DependInfo.cmake" is newer than depender "/Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/depend.internal".
Dependee "/Users/arkasantra/tmp/test/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/arkasantra/tmp/test/build/CMakeFiles/G__LUXESimEventDict.dir/depend.internal".
Scanning dependencies of target G__LUXESimEventDict
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/G__LUXESimEventDict.dir/build.make CMakeFiles/G__LUXESimEventDict.dir/build
[ 66%] Building CXX object CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -I/Users/arkasantra/tmp/test -isystem /Users/arkasantra/Root6_Install/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -fPIC -std=gnu++17 -MD -MT CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o -MF CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o.d -o CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o -c /Users/arkasantra/tmp/test/build/G__LUXESimEventDict.cxx
[ 66%] Built target G__LUXESimEventDict
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/LUXESimEventDict.dir/build.make CMakeFiles/LUXESimEventDict.dir/depend
cd /Users/arkasantra/tmp/test/build && /usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_depends "Unix Makefiles" /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build /Users/arkasantra/tmp/test/build/CMakeFiles/LUXESimEventDict.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/LUXESimEventDict.dir/build.make CMakeFiles/LUXESimEventDict.dir/build
[100%] Linking CXX shared library libLUXESimEventDict.dylib
/usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_link_script CMakeFiles/LUXESimEventDict.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -dynamiclib -Wl,-headerpad_max_install_names -L/usr/local/opt/qt@5/lib -o libLUXESimEventDict.dylib -install_name @rpath/libLUXESimEventDict.dylib CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o
Undefined symbols for architecture x86_64:
  "Fatal(char const*, char const*, ...)", referenced from:
      ROOT::Detail::TCollectionProxyInfo::Iterators<std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, false>::next(void*, void const*) in G__LUXESimEventDict.cxx.o
  "TVersionCheck::TVersionCheck(int)", referenced from:
      ___cxx_global_var_init in G__LUXESimEventDict.cxx.o
  "ROOT::AddClassAlternate(char const*, char const*)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::Class_ShowMembers(TClass*, void const*, TMemberInspector&)", referenced from:
      Dummy::ShowMembers(TMemberInspector&) const in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetNewArray(void* (*)(long, void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetDestructor(void (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::AdoptAlternate(ROOT::TClassAlt*)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetDeleteArray(void (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::GetImplFileLine()", referenced from:
      Dummy::ImplFileLine() in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::GetImplFileName()", referenced from:
      Dummy::ImplFileName() in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::AdoptCollectionProxyInfo(ROOT::Detail::TCollectionProxyInfo*)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetNew(void* (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::GetClass()", referenced from:
      Dummy::Dictionary() in G__LUXESimEventDict.cxx.o
      Dummy::Class() in G__LUXESimEventDict.cxx.o
      ROOT::vectorlEtuplelEintcOdoublegRsPgR_Dictionary() in G__LUXESimEventDict.cxx.o
      ROOT::maplEunsignedsPlongcOvectorlEtuplelEintcOdoublegRsPgRsPgR_Dictionary() in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::SetDelete(void (*)(void*))", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.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(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::TGenericClassInfo::~TGenericClassInfo()", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::Internal::DefineBehavior(void*, void*)", referenced from:
      ROOT::GenerateInitInstanceLocal(Dummy const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "ROOT::Internal::HasConsistentHashMember(char const*)", referenced from:
      Dummy::CheckTObjectHashConsistency() const in G__LUXESimEventDict.cxx.o
  "ROOT::Internal::HasConsistentHashMember(TClass&)", referenced from:
      Dummy::CheckTObjectHashConsistency() const in G__LUXESimEventDict.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<char>, std::__1::allocator<char>>, int>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int>>> const&, char const**, bool)", referenced from:
      (anonymous namespace)::TriggerDictionaryInitialization_libLUXESimEventDict_Impl() in G__LUXESimEventDict.cxx.o
  "TIsAProxy::TIsAProxy(std::type_info const&)", referenced from:
      ROOT::GenerateInitInstanceLocal(std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>> const*) in G__LUXESimEventDict.cxx.o
      ROOT::GenerateInitInstanceLocal(std::__1::map<unsigned long, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, std::__1::less<unsigned long>, std::__1::allocator<std::__1::pair<unsigned long const, std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>>>> const*) in G__LUXESimEventDict.cxx.o
  "_gInterpreterMutex", referenced from:
      Dummy::Class() in G__LUXESimEventDict.cxx.o
  "_kAssertMsg", referenced from:
      ROOT::Detail::TCollectionProxyInfo::Iterators<std::__1::vector<std::__1::tuple<int, double>, std::__1::allocator<std::__1::tuple<int, double>>>, false>::next(void*, void const*) in G__LUXESimEventDict.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]: *** [libLUXESimEventDict.dylib] Error 1
make[1]: *** [CMakeFiles/LUXESimEventDict.dir/all] Error 2
make: *** [all] Error 2

The other option:

target_link_libraries(
    G__LUXESimEventDict 
    PUBLIC 
    ROOT::RIO)

also gave similar error.

Thank you,
Arka

I see

/usr/local/Cellar/cmake/3.25.0/bin/cmake -E cmake_link_script CMakeFiles/LUXESimEventDict.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  
   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk 
   -dynamiclib -Wl,-headerpad_max_install_names -L/usr/local/opt/qt@5/lib 
   -o libLUXESimEventDict.dylib -install_name @rpath/libLUXESimEventDict.dylib
   CMakeFiles/G__LUXESimEventDict.dir/G__LUXESimEventDict.cxx.o

where the required shared library are clearly missing (needs at least libCore).

The library being build is LUXESimEventDict. and indeed in your CMakeList.txt (from the code I just downloaded I see:

add_library(LUXESimEventDict SHARED)
...
ROOT_GENERATE_DICTIONARY(
...
    MODULE
    LUXESimEventDict 
...

BUT

target_link_libraries(
    G__LUXESimEventDict
    PRIVATE
    ROOT::RIO)

Apply:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 997ab97..77cd09f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ ROOT_GENERATE_DICTIONARY(
     LUXESimEventDict 
     LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/LinkDef.h)
 target_link_libraries(
-    G__LUXESimEventDict 
+    LUXESimEventDict
     PRIVATE 
     ROOT::RIO)
     

to fix it.

Dear @pcanal ,
Sorry for the late reply: I was very busy with something else.
Your suggestion of

-    G__LUXESimEventDict 
+    LUXESimEventDict

solved my problem, and now I do not have any issues compiling.

While we are at it, just for my own understanding, may I know why

G__LUXESimEventDict

worked for Linux and

LUXESimEventDict

worked for Mac?

Thank you very much,
Arka

On Mac the default is to require all the symbols of shared library to be resolved at the time that shared library is linked/created. On Linux it let you create shared libraries with missing symbols (that can be later provided by the executable). So on Mac you need to have the correct dependencies setup in CMake.

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