ROOT Version: 6.34.04
Platform: win64
(Windows 10)
Compiler: MSVC 19.33.31630.0
Boost Version: 1.81
Dear ROOT Developers & Maintainers,
I try to port the software of my client to ROOT 6.34. And I encountered a crash on Windows 10.
It may be related to TMethodCall
and/or Boost.Coroutine2.
MWE
Here is a MWE which attempts to reproduce the problem: Files · 44135 · Uranie CEA / Prerequisites / Prerequisites Detection / Detect ROOT + Boost · GitLab
$ tree
.
├── CMakeLists.txt
├── inc
│ ├── LinkDef.h
│ └── Routine.hpp
├── print.C
├── src
│ └── Routine.cpp
└── test_routine.C
add_test(NAME routine_with_macro
COMMAND ${ROOT_root_CMD} -q
"${CMAKE_CURRENT_SOURCE_DIR}/test_routine.C(\"${CMAKE_CURRENT_SOURCE_DIR}/print.C\", \"print\")")
add_test(NAME routine_without_macro
COMMAND ${ROOT_root_CMD} -q "${CMAKE_CURRENT_SOURCE_DIR}/test_routine.C(\"\", \"\")")
#pragma link C++ class MWE::Routine;
namespace MWE {
class Routine {
public:
Routine(const std::string& macro, const std::string& name): _macro{macro}, _name{name} {};
void test();
[...]
};
}
void print(int number) {
cout << "print::number: " << number << endl;
}
[...]
void my_print(int number) {
std::cout << "my_print::number: " << number << std::endl;
}
ClassImp(MWE::Routine);
void MWE::Routine::test() {
if (!_macro.empty()) {
std::cout << "test::macro: " << _macro << std::endl;
gROOT->LoadMacro(_macro.data());
}
TMethodCall call;
if (!_name.empty()) {
std::cout << "test::name: " << _name << std::endl;
call.Init(_name.data(), "0");
}
coroutine_t::pull_type source(
[&](coroutine_t::push_type& sink) {
int value=1;
if (_name.empty())
my_print(0);
else
call.Execute();
sink(value);
}
);
[...]
}
void test_routine(const string& macro, const string& name) {
MWE::Routine routine(macro, name);
routine.test();
}
ROOT 6.32
ROOT 6.32 seems to run the tests:
$ Get-Variable CXX_STANDARD,CMAKE_CONFIGURATION_TYPES,CTEST_OPTIONS
CXX_STANDARD 17
CMAKE_CONFIGURATION_TYPES Release
CTEST_OPTIONS -VV
$ cmake -DCMAKE_INSTALL_PREFIX="${CI_PROJECT_DIR}/install" ../ -DCMAKE_CXX_STANDARD="${CXX_STANDARD}"
[...]
-- Found Boost: C:/.../detect-root-boost/outputs/boost/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.66") found components: coroutine system
[...]
$ cmake --build . --config ${CMAKE_CONFIGURATION_TYPES} --target install -j $(Get-ComputerInfo -Property CsProcessors).CsProcessors.NumberOfCores[0]
[...]
$ ctest -C ${CMAKE_CONFIGURATION_TYPES} ${CTEST_OPTIONS}
[...]
1: ------------------------------------------------------------------
1: | Welcome to ROOT 6.32.08 https://root.cern |
1: | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
1: | Built for win64 on Jan 24 2025, 09:43:32 |
1: | From tags/v6-32-08@v6-32-08 |
1: | With MSVC 19.33.31630.0 |
1: | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
1: ------------------------------------------------------------------
1:
1:
1: Processing C:/.../detect-root-boost/test_routine.C("C:/.../detect-root-boost/print.C", "print")...
1: test::macro: C:/.../detect-root-boost/print.C
1: test::name: print
1: print::number: 0
1: test::source: 1
1/3 Test #1: routine_with_macro ............... Passed 0.50 sec
[...]
2: ------------------------------------------------------------------
2: | Welcome to ROOT 6.32.08 https://root.cern |
2: | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
2: | Built for win64 on Jan 24 2025, 09:43:32 |
2: | From tags/v6-32-08@v6-32-08 |
2: | With MSVC 19.33.31630.0 |
2: | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
2: ------------------------------------------------------------------
2:
2:
2: Processing C:/.../detect-root-boost/test_routine.C("", "")...
2: my_print::number: 0
2: test::source: 1
2/3 Test #2: routine_without_macro ............ Passed 0.41 sec
ROOT 6.34
With ROOT 6.34, routine_with_macro
crashes:
1: ------------------------------------------------------------------
1: | Welcome to ROOT 6.34.04 https://root.cern |
1: | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
1: | Built for win64 on Feb 13 2025, 18:30:09 |
1: | From tags/v6-34-04@v6-34-04 |
1: | With MSVC 19.33.31630.0 |
1: | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
1: ------------------------------------------------------------------
1:
1:
1: Processing C:/.../detect-root-boost/test_routine.C("C:/.../detect-root-boost/print.C", "print")...
1: test::macro: C:/.../detect-root-boost/print.C
1: test::name: print
1/3 Test #1: routine_with_macro ...............***Exception: SegFault 0.60 sec
[...]
2: ------------------------------------------------------------------
2: | Welcome to ROOT 6.34.04 https://root.cern |
2: | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
2: | Built for win64 on Feb 13 2025, 18:30:09 |
2: | From tags/v6-34-04@v6-34-04 |
2: | With MSVC 19.33.31630.0 |
2: | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
2: ------------------------------------------------------------------
2:
2:
2: Processing C:/.../detect-root-boost/test_routine.C("", "")...
2: my_print::number: 0
2: test::source: 1
2/3 Test #2: routine_without_macro ............ Passed 0.33 sec
I apologise for the long post & multiple edits.
- Do you recommend avoiding
TMethodCall
? - Or do you think the issue may be elsewhere ?
Best Regards,