Rdict.pcm file not found

Hi everyone,

I am building a small project with the following structure with CMake:

├── App
│   ├── App.cxx
│   └── CMakeLists.txt
├── Reconstruction
│   ├── CMakeLists.txt
│   ├── inc
│   └── src
├── More_Folders
│   ├── CMakeLists.txt
│   ├── inc
│   └── src
└── CMakeLists.txt

In the Reconstruction folder, I define dictionaries to write and read custom defined classes. My Reconstruction/CMakeLists.txt is very basic:

# Add source files
file(GLOB SOURCES "src/*.cxx")

# Add a library target
add_library(ReconstructionLibrary ${SOURCES})

# Set include directories for library target
target_include_directories(ReconstructionLibrary PUBLIC inc)

# Generate ROOT dictionary
root_generate_dictionary(Reconstruction_dict inc/dEdx.h LINKDEF inc/Recon_LinkDef.h MODULE ReconstructionLibrary)
root_generate_dictionary(ERAMinfo_dict inc/LUTs.h LINKDEF inc/Recon_LinkDef.h MODULE ReconstructionLibrary)

# Link the ROOT dictionary to the library
target_link_libraries(ReconstructionLibrary PUBLIC MiscLibrary SignalModelLibrary EvtModelLibrary FittersLibrary SampleToolsLibrary EvtModelToolsLibrary)

This library is then linked to the executable in the App directory with this very short App/CMakeLists.txt:

add_executable(App App.cxx)
target_link_libraries(App MiscLibrary SignalModelLibrary EvtModelLibrary FittersLibrary SampleToolsLibrary EvtModelToolsLibrary ReconstructionLibrary ${ROOT_LIBRARIES})

Eventually, the top-level CMakeLists.txt is as follow:

cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(dEdxRecon)

find_package(ROOT REQUIRED COMPONENTS RIO Tree)
include_directories(${ROOT_INCLUDE_DIRS})

# Add subdirectories
add_subdirectory(App)
add_subdirectory(Reconstruction)
add_subdirectory(Other_folders)

However, after compilation, during the execution of the code, I get the following error:

Error in <TCling::LoadPCM>: ROOT PCM path_to_workspace/build/App/libReconstructionLibrary_rdict.pcm file does not exist

since the rdict.pcm files are created in the build/Reconstruction folder, not the App one. I believe this is related to this thread, even though I couldn’t solve it.
What should I change so that TCling does not look for the PCM files in the build/App folder but rather in the build/Reconstruction folder, where they were actually created?

Cheers,
Tristan


ROOT Version: 6.30/04


Dear Tristan,

ROOT expects the “rootpcm” file to sit next to the library that contains its dictionary (rootcling/genreflex output a pcm and a cxx file, which needs to be compiled in a shared object).

Is this the case for your setup?

Best,
Danilo

Hi Danilo,

Here is my file tree of the build folder:

├── App
│   ├── App
│   ├── CMakeFiles
│   ├── cmake_install.cmake
│   └── Makefile
├── CMakeCache.txt
├── CMakeFiles
│   ├── 3.22.1
│   ├── cmake.check_cache
│   ├── CMakeDirectoryInformation.cmake
│   ├── CMakeOutput.log
│   ├── CMakeRuleHashes.txt
│   ├── CMakeTmp
│   ├── Makefile2
│   ├── Makefile.cmake
│   ├── progress.marks
│   └── TargetDirectories.txt
├── cmake_install.cmake
├── Other_folders
├── Makefile
└── Reconstruction
    ├── CMakeFiles
    ├── cmake_install.cmake
    ├── ERAMinfo_dict.cxx
    ├── libReconstructionLibrary.a
    ├── libReconstructionLibrary_rdict.pcm
    ├── libReconstructionLibrary.rootmap
    ├── Makefile
    ├── module.modulemap
    └── Reconstruction_dict.cxx

So I believe that the .pcm file is indeed in the same folder as the .cxx file in the dictionary. Please correct me if I misunderstood something here!

Cheers,
Tristan

I believe my issue is similar to the one addressed here, but it never received an answer, sadly.