Hi @vvassilev, at the end i did several test, which possibly link to some LinkDef issue and header files i am using. I have not managed to get the NO_CXXMODULE configuration working and also the extra flags -cxxmodule-writeEmptyPCMFiles
was not working
I ended up having something working fine proceeding as in the zip file for my reduced CMake project creating libraries and used inside python .
for_root_forum.zip (369.9 KB)
for each library i have i added #include in the LinkDef.h files for all headers
In each CMakeLists.txt i did
ROOT_GENERATE_DICTIONARY(G__${PROJECT}
${HEADERS}
LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/LinkDef.h
MODULE ${PROJECT}
add_library(${PROJECT} SHARED ${SOURCES} G__${PROJECT}.cxx)
target_include_directories(${PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)
target_link_libraries(${PROJECT} PUBLIC ${PKG_LIBRARIES})
)
Then i set the PYTHONPATH to python/ folder where analysis folder contains an init.py file which does some trick to get the modulemap and soft links done on the fly.
When analysis
is imported i create all soft links on the fly and i os.chdir( BUILDDIRECTORY)
where i also cat
all the module.modulemap files and i soft link
*/*.pcm, */*.dylib
Everything seems working
in /build
folder.
Then i cat */module.modulemap
I noticed that the crash happens if import ROOT as r
is not executed in the path where the libraries exists.
I don’t know what would be an alternative to all this the only issue i am left with mograting from ROOT 6.18 to 6.22 is that with all those updates i still get a couple of warning in the python interaction :
from analysis import *
#this is now prompting this message
<<< cling interactive line includer >>>: warning: missing submodule 'roofit' [-Wincomplete-umbrella]
Failed to load module roofit
, however i can create a r.RooIpatia2() function which is expected to be defined inside my roofit extra library.
Ideally i would like to avoid to do the tricks you see in in python/analysis/__init__.py
however i guess one has to maybe improve the LinkDef.h files, CMakeLists around and possibly refactor all the code.
Otherwise maybe i am missing something.
If in the script to import the libraries I don’t cd
the path where the module map are located before doing import ROOT as r, i get the segfault and many more errors. I don’t know why.
To be clear on my setup :
$|=>root --version
ROOT Version: 6.22/07
Built for macosx64 on Dec 24 2020, 07:38:23
From heads/v6-22-00-patches@v6-22-06-5-g5e69c10422
,
$|=>python
Python 3.9.1 (default, Dec 17 2020, 10:08:12)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
and
-- CMAKE_CXX_COMPILER_ID = AppleClang
-- Detecting GSL
-- GSL_VERSION = 2.6
-- GSL_INCLUDES = /usr/local/Cellar/gsl/2.6/include
-- GSL_LIBRARIES = /usr/local/Cellar/gsl/2.6/lib/libgsl.dylib;/usr/local/Cellar/gsl/2.6/lib/libgslcblas.dylib
-- Detecting ROOT
-- ROOT_VERSION = 6.22.99
-- ROOT_INCLUDES = /Users/lpnhe/root_build/include
-- Detecting YAMLCPP
-- YAMLCPP_VERSION = 0.6.2
-- YAMLCPP_INCLUDES = /usr/local/include
-- YAMLCPP_LIBRARIES = yaml-cpp
-- YAMLCPP_LIBRARIES = /usr/local/lib/libyaml-cpp.dylib
--
-- Detecting BOOST
-- BOOST_VERSION = 1.75.0
-- BOOST_INCLUDES = /usr/local/include
-- BOOST_LIBRARIES = Boost::system;Boost::filesystem