Home | News | Documentation | Download

Problem with TMVA when building ROOT from source

Hi all,

I’m struggling to install ROOT on my Manjaro Linux system (I had almost identical issues on Ubuntu 20.04 so I just went back to Manjaro). I can install it from pacman and it runs fine, but I’m trying to build it from source because I need certain things like GPU support for TMVA. The issue seems to be coming from the TMVA part of building root, it comes up when I go to run the “make” command. My cmake command is

cmake ../ -Dall=ON -Dtmva-gpu=ON -Dcuda=ON -Dcudnn=ON -Dtmva=ON -DCMAKE_CUDA_ARCHITECTURES="61" -DCMAKE_INSTALL_PREFIX=~/root/root-6.24.02-install
make -j6

Everything seems to run fine until about 90ish % and then errors come up when it gets to TMVA. (The three dots are just more lines similar to those shown, but with different things instead of “BDT.cxx”)

[ 98%] Linking CXX shared library ../../lib/libTMVAGui.so
.
.
.
/usr/bin/ld: CMakeFiles/TMVAGui.dir/src/correlationscattersMultiClass.cxx.o:correlationscattersMultiClass.cxx:(.text+0xa7f): more undefined references to `TMVA::gConfig()' follow
/usr/bin/ld: CMakeFiles/TMVAGui.dir/src/BDT.cxx.o: in function `TMVA::StatDialogBDT::GetNtrees()':
BDT.cxx:(.text+0x541): undefined reference to `TMVA::gTools()'
/usr/bin/ld: BDT.cxx:(.text+0x573): undefined reference to `TMVA::gTools()'
/usr/bin/ld: BDT.cxx:(.text+0x587): undefined reference to `TMVA::gTools()'
/usr/bin/ld: BDT.cxx:(.text+0x5b1): undefined reference to `TMVA::gTools()'
/usr/bin/ld: BDT.cxx:(.text+0x5db): undefined reference to `TMVA::gTools()'
/usr/bin/ld: CMakeFiles/TMVAGui.dir/src/BDT.cxx.o:BDT.cxx:(.text+0x606): more undefined references to `TMVA::gTools()' follow
/usr/bin/ld: CMakeFiles/TMVAGui.dir/src/BDT.cxx.o: in function `TMVA::StatDialogBDT::GetNtrees()':
.
.
.
collect2: error: ld returned 1 exit status
make[2]: *** [tmva/tmvagui/CMakeFiles/TMVAGui.dir/build.make:684: lib/libTMVAGui.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:35543: tmva/tmvagui/CMakeFiles/TMVAGui.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

I checked the /lib/ folder for the libTMVA.so file, but it wasn’t there like all of the other lib files seemed to be (same for libTMVAGui.so). I tried to copy those two .so files from a working ROOT install on another machine and reran everything but that just gave me basically the same issue. Here’s a chunk of that (again the lone dots are just more lines similar to what’s shown)

[ 97%] Linking CXX shared library ../../lib/libTMVA.so
/usr/bin/ld: CMakeFiles/TMVA.dir/src/BinarySearchTree.cxx.o: in function `std::deque<std::pair<TMVA::BinarySearchTreeNode const*, int>, std::allocator<std::pair<TMVA::BinarySearchTreeNode const*, int> > >::_M_reallocate_map(unsigned long, bool)':
BinarySearchTree.cxx:(.text._ZNSt5dequeISt4pairIPKN4TMVA20BinarySearchTreeNodeEiESaIS5_EE17_M_reallocate_mapEmb[_ZNSt5dequeISt4pairIPKN4TMVA20BinarySearchTreeNodeEiESaIS5_EE17_M_reallocate_mapEmb]+0x197): undefined reference to `std::__throw_bad_array_new_length()'
.
.
.
collect2: error: ld returned 1 exit status
make[2]: *** [tmva/tmva/CMakeFiles/TMVA.dir/build.make:2843: lib/libTMVA.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:35426: tmva/tmva/CMakeFiles/TMVA.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

On an earlier attempt it got past this part (probably with errors that I didn’t notice) and I ran the cmake build step, and then set the source as per the instructions on the ROOT website. The problem that time was after I ran root, I tried to tab complete after typing TMVA:: to get the list that normally comes up, but instead I got an error. I didn’t save those errors, and I deleted everything and restarted and this is where I’m at now. I’m not super experienced with Linux or CMake, and this is the first thing I’ve ever tried to build from source, so any help would be appreciated. Again, the errors seem to keep coming around any time TMVA gets involved.

ROOT Version: 6.24.02
Platform: Manjaro Linux 21.1.0 x86_64
Compiler: gcc?
System:

  • CPU: Intel i7-8700k
  • GPU: Nvidia GTX 1070ti
  • RAM: 32GB

@moneta Do you have an idea?

Hi,
I have no idea what this could be. I have never built ROOT on that distribution, but this looks a weird error, it has apparently nothing to do with the GPU, and we build the TMVA BDT classes on many different systems.
Have you tried from a clean build without having defined any environment variables pointing to some other ROOT version ?

Lorenzo

This is a fresh Linux install, all I’ve done is install all of ROOT’s prerequisites, CUDA, and CuDNN. I had the same issue with the TMVA part of the build when I tried it on Ubuntu 20.04.

Could the issue be coming from CUDA? When I installed it I installed cuda-11.3.1-1 and cudnn-8.2.1.32-1, but when I run nvidia-smi it says cuda version 11.4. I don’t know if that could have any effect.

From what I’ve found the “/usr/bin/ld” implies there’s something wrong with linking the TMVA library maybe? There’s a lot of errors about

Method*.cxx undefined reference to 'std::__throw_bad_array_new_length()' 

and

Method*.cxx undefined reference to 'std::__exception_ptr::exception_ptr::_M_release()'

Here is the full output starting from the linking libTMVA.so step

[ 95%] Linking CXX shared library ../../lib/libTMVA.so
[ 95%] Built target Gviz3d
Consolidate compiler generated dependencies of target Eve
[ 95%] Linking CXX shared library ../../lib/libEve.so
[ 95%] Built target RooFit
[ 95%] Generating G__RooStats.cxx, ../../lib/RooStats.pcm
[ 95%] Generating G__RooFitMore.cxx, ../../lib/RooFitMore.pcm
/usr/bin/ld: CMakeFiles/TMVA.dir/src/BinarySearchTree.cxx.o: in function `std::deque<std::pair<TMVA::BinarySearchTreeNode const*, int>, std::allocator<std::pair<TMVA::BinarySearchTreeNode const*, int> > >::_M_reallocate_map(unsigned long, bool)':
BinarySearchTree.cxx:(.text._ZNSt5dequeISt4pairIPKN4TMVA20BinarySearchTreeNodeEiESaIS5_EE17_M_reallocate_mapEmb[_ZNSt5dequeISt4pairIPKN4TMVA20BinarySearchTreeNodeEiESaIS5_EE17_M_reallocate_mapEmb]+0x197): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/BinarySearchTreeNode.cxx.o: in function `TMVA::BinarySearchTreeNode::BinarySearchTreeNode(TMVA::BinarySearchTreeNode const&, TMVA::BinarySearchTreeNode*)':
BinarySearchTreeNode.cxx:(.text+0xd26): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: BinarySearchTreeNode.cxx:(.text+0xd66): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/Classification.cxx.o: in function `std::_Rb_tree_node<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > >* std::_Rb_tree<unsigned int, std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > >, std::_Select1st<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > > >::_M_copy<false, std::_Rb_tree<unsigned int, std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > >, std::_Select1st<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > > >::_Reuse_or_alloc_node>(std::_Rb_tree_node<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > >*, std::_Rb_tree_node_base*, std::_Rb_tree<unsigned int, std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > >, std::_Select1st<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, std::vector<std::tuple<float, float, bool>, std::allocator<std::tuple<float, float, bool> > > > > >::_Reuse_or_alloc_node&) [clone .isra.0]':
Classification.cxx:(.text+0x7bc): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: Classification.cxx:(.text+0x7cb): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/Classification.cxx.o:Classification.cxx:(.text+0x7d5): more undefined references to `std::__throw_bad_array_new_length()' follow
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `std::__future_base::_State_baseV2::_M_break_promise(std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>)':
MethodDNN.cxx:(.text._ZNSt13__future_base13_State_baseV216_M_break_promiseESt10unique_ptrINS_12_Result_baseENS2_8_DeleterEE[_ZNSt13__future_base13_State_baseV216_M_break_promiseESt10unique_ptrINS_12_Result_baseENS2_8_DeleterEE]+0x17b): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZNSt13__future_base13_State_baseV216_M_break_promiseESt10unique_ptrINS_12_Result_baseENS2_8_DeleterEE[_ZNSt13__future_base13_State_baseV216_M_break_promiseESt10unique_ptrINS_12_Result_baseENS2_8_DeleterEE]+0x18a): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `std::vector<double, std::allocator<double> >::vector(std::vector<double, std::allocator<double> > const&)':
MethodDNN.cxx:(.text._ZNSt6vectorIdSaIdEEC2ERKS1_[_ZNSt6vectorIdSaIdEEC5ERKS1_]+0x8e): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `TMVA::DNN::TNet<TMVA::DNN::TCpu<float>, TMVA::DNN::TLayer<TMVA::DNN::TCpu<float> > >::TNet(TMVA::DNN::TNet<TMVA::DNN::TCpu<float>, TMVA::DNN::TLayer<TMVA::DNN::TCpu<float> > > const&)':
MethodDNN.cxx:(.text._ZN4TMVA3DNN4TNetINS0_4TCpuIfEENS0_6TLayerIS3_EEEC2ERKS6_[_ZN4TMVA3DNN4TNetINS0_4TCpuIfEENS0_6TLayerIS3_EEEC5ERKS6_]+0x100): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `TMVA::DNN::LayerData* std::__uninitialized_copy<false>::__uninit_copy<TMVA::DNN::LayerData const*, TMVA::DNN::LayerData*>(TMVA::DNN::LayerData const*, TMVA::DNN::LayerData const*, TMVA::DNN::LayerData*)':
MethodDNN.cxx:(.text._ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPKN4TMVA3DNN9LayerDataEPS4_EET0_T_S9_S8_[_ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPKN4TMVA3DNN9LayerDataEPS4_EET0_T_S9_S8_]+0x2d6): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPKN4TMVA3DNN9LayerDataEPS4_EET0_T_S9_S8_[_ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPKN4TMVA3DNN9LayerDataEPS4_EET0_T_S9_S8_]+0x2e6): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPKN4TMVA3DNN9LayerDataEPS4_EET0_T_S9_S8_[_ZNSt20__uninitialized_copyILb0EE13__uninit_copyIPKN4TMVA3DNN9LayerDataEPS4_EET0_T_S9_S8_]+0x2f6): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o:MethodDNN.cxx:(.text._ZNSt6vectorIN4TMVA3DNN9LayerDataESaIS2_EE17_M_realloc_insertIJS2_EEEvN9__gnu_cxx17__normal_iteratorIPS2_S4_EEDpOT_[_ZNSt6vectorIN4TMVA3DNN9LayerDataESaIS2_EE17_M_realloc_insertIJS2_EEEvN9__gnu_cxx17__normal_iteratorIPS2_S4_EEDpOT_]+0x4c6): more undefined references to `std::__throw_bad_array_new_length()' follow
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<double>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<TMVA::DNN::Net::trainCycle<__gnu_cxx::__normal_iterator<Pattern*, std::vector<Pattern, std::allocator<Pattern> > >, TMVA::DNN::Steepest>(TMVA::DNN::Steepest&, std::vector<double, std::allocator<double> >&, __gnu_cxx::__normal_iterator<Pattern*, std::vector<Pattern, std::allocator<Pattern> > >, __gnu_cxx::__normal_iterator<Pattern*, std::vector<Pattern, std::allocator<Pattern> > >, TMVA::DNN::Settings&, std::vector<char, std::allocator<char> >&)::{lambda()#1}> >, double> >::_M_invoke(std::_Any_data const&)':
MethodDNN.cxx:(.text._ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultIdEES3_ENSt6thread8_InvokerISt5tupleIJZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorISJ_SaISJ_EEEENSE_8SteepestEEEdRT0_RSL_IdSaIdEET_SV_RNSE_8SettingsERSL_IcSaIcEEEUlvE_EEEEdEEE9_M_invokeERKSt9_Any_data[_ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultIdEES3_ENSt6thread8_InvokerISt5tupleIJZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorISJ_SaISJ_EEEENSE_8SteepestEEEdRT0_RSL_IdSaIdEET_SV_RNSE_8SettingsERSL_IcSaIcEEEUlvE_EEEEdEEE9_M_invokeERKSt9_Any_data]+0x443): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultIdEES3_ENSt6thread8_InvokerISt5tupleIJZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorISJ_SaISJ_EEEENSE_8SteepestEEEdRT0_RSL_IdSaIdEET_SV_RNSE_8SettingsERSL_IcSaIcEEEUlvE_EEEEdEEE9_M_invokeERKSt9_Any_data[_ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultIdEES3_ENSt6thread8_InvokerISt5tupleIJZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorISJ_SaISJ_EEEENSE_8SteepestEEEdRT0_RSL_IdSaIdEET_SV_RNSE_8SettingsERSL_IcSaIcEEEUlvE_EEEEdEEE9_M_invokeERKSt9_Any_data]+0x453): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `double TMVA::DNN::Net::trainCycle<__gnu_cxx::__normal_iterator<Pattern*, std::vector<Pattern, std::allocator<Pattern> > >, TMVA::DNN::Steepest>(TMVA::DNN::Steepest&, std::vector<double, std::allocator<double> >&, __gnu_cxx::__normal_iterator<Pattern*, std::vector<Pattern, std::allocator<Pattern> > >, __gnu_cxx::__normal_iterator<Pattern*, std::vector<Pattern, std::allocator<Pattern> > >, TMVA::DNN::Settings&, std::vector<char, std::allocator<char> >&)':
MethodDNN.cxx:(.text._ZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorIS5_SaIS5_EEEENS0_8SteepestEEEdRT0_RS7_IdSaIdEET_SH_RNS0_8SettingsERS7_IcSaIcEE[_ZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorIS5_SaIS5_EEEENS0_8SteepestEEEdRT0_RS7_IdSaIdEET_SH_RNS0_8SettingsERS7_IcSaIcEE]+0x6bd): undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorIS5_SaIS5_EEEENS0_8SteepestEEEdRT0_RS7_IdSaIdEET_SH_RNS0_8SettingsERS7_IcSaIcEE[_ZN4TMVA3DNN3Net10trainCycleIN9__gnu_cxx17__normal_iteratorIP7PatternSt6vectorIS5_SaIS5_EEEENS0_8SteepestEEEdRT0_RS7_IdSaIdEET_SH_RNS0_8SettingsERS7_IcSaIcEE]+0x76a): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<std::tuple<double, std::vector<double, std::allocator<double> > > >, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<TMVA::DNN::Net::train<TMVA::DNN::Steepest>(std::vector<double, std::allocator<double> >&, std::vector<Pattern, std::allocator<Pattern> >&, std::vector<Pattern, std::allocator<Pattern> > const&, TMVA::DNN::Steepest&, TMVA::DNN::Settings&)::{lambda()#1}> >, std::tuple<double, std::vector<double, std::allocator<double> > > > >::_M_invoke(std::_Any_data const&)':
MethodDNN.cxx:(.text._ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultISt5tupleIJdSt6vectorIdSaIdEEEEEES3_ENSt6thread8_InvokerIS8_IJZN4TMVA3DNN3Net5trainINSI_8SteepestEEEdRSB_RS9_I7PatternSaISN_EERKSP_RT_RNSI_8SettingsEEUlvE_EEEESC_EEE9_M_invokeERKSt9_Any_data[_ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultISt5tupleIJdSt6vectorIdSaIdEEEEEES3_ENSt6thread8_InvokerIS8_IJZN4TMVA3DNN3Net5trainINSI_8SteepestEEEdRSB_RS9_I7PatternSaISN_EERKSP_RT_RNSI_8SettingsEEUlvE_EEEESC_EEE9_M_invokeERKSt9_Any_data]+0x19a): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultISt5tupleIJdSt6vectorIdSaIdEEEEEES3_ENSt6thread8_InvokerIS8_IJZN4TMVA3DNN3Net5trainINSI_8SteepestEEEdRSB_RS9_I7PatternSaISN_EERKSP_RT_RNSI_8SettingsEEUlvE_EEEESC_EEE9_M_invokeERKSt9_Any_data[_ZNSt17_Function_handlerIFSt10unique_ptrINSt13__future_base12_Result_baseENS2_8_DeleterEEvENS1_12_Task_setterIS0_INS1_7_ResultISt5tupleIJdSt6vectorIdSaIdEEEEEES3_ENSt6thread8_InvokerIS8_IJZN4TMVA3DNN3Net5trainINSI_8SteepestEEEdRSB_RS9_I7PatternSaISN_EERKSP_RT_RNSI_8SettingsEEUlvE_EEEESC_EEE9_M_invokeERKSt9_Any_data]+0x1a9): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodDNN.cxx.o: in function `double TMVA::DNN::Net::train<TMVA::DNN::Steepest>(std::vector<double, std::allocator<double> >&, std::vector<Pattern, std::allocator<Pattern> >&, std::vector<Pattern, std::allocator<Pattern> > const&, TMVA::DNN::Steepest&, TMVA::DNN::Settings&)':
MethodDNN.cxx:(.text._ZN4TMVA3DNN3Net5trainINS0_8SteepestEEEdRSt6vectorIdSaIdEERS4_I7PatternSaIS8_EERKSA_RT_RNS0_8SettingsE[_ZN4TMVA3DNN3Net5trainINS0_8SteepestEEEdRSt6vectorIdSaIdEERS4_I7PatternSaIS8_EERKSA_RT_RNS0_8SettingsE]+0x1746): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZN4TMVA3DNN3Net5trainINS0_8SteepestEEEdRSt6vectorIdSaIdEERS4_I7PatternSaIS8_EERKSA_RT_RNS0_8SettingsE[_ZN4TMVA3DNN3Net5trainINS0_8SteepestEEEdRSt6vectorIdSaIdEERS4_I7PatternSaIS8_EERKSA_RT_RNS0_8SettingsE]+0x19d6): undefined reference to `std::__exception_ptr::exception_ptr::_M_addref()'
/usr/bin/ld: MethodDNN.cxx:(.text._ZN4TMVA3DNN3Net5trainINS0_8SteepestEEEdRSt6vectorIdSaIdEERS4_I7PatternSaIS8_EERKSA_RT_RNS0_8SettingsE[_ZN4TMVA3DNN3Net5trainINS0_8SteepestEEEdRSt6vectorIdSaIdEERS4_I7PatternSaIS8_EERKSA_RT_RNS0_8SettingsE]+0x1d1d): undefined reference to `std::__exception_ptr::exception_ptr::_M_release()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodKNN.cxx.o: in function `std::vector<float, std::allocator<float> >::operator=(std::vector<float, std::allocator<float> > const&) [clone .isra.0]':
MethodKNN.cxx:(.text+0x1d6): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodKNN.cxx.o: in function `TMVA::MethodKNN::GetRegressionValues()':
MethodKNN.cxx:(.text+0xc5f): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: MethodKNN.cxx:(.text+0xdd5): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodKNN.cxx.o: in function `TMVA::MethodKNN::Train()':
MethodKNN.cxx:(.text+0x2343): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: MethodKNN.cxx:(.text+0x234d): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: CMakeFiles/TMVA.dir/src/MethodKNN.cxx.o:MethodKNN.cxx:(.text+0x322b): more undefined references to `std::__throw_bad_array_new_length()' follow
collect2: error: ld returned 1 exit status
make[2]: *** [tmva/tmva/CMakeFiles/TMVA.dir/build.make:2843: lib/libTMVA.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:35426: tmva/tmva/CMakeFiles/TMVA.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 96%] Built target Eve
Scanning dependencies of target G__RooFitMore
Consolidate compiler generated dependencies of target G__RooFitMore
[ 96%] Building CXX object roofit/roofitmore/CMakeFiles/G__RooFitMore.dir/G__RooFitMore.cxx.o
Scanning dependencies of target G__RooStats
Consolidate compiler generated dependencies of target G__RooStats
[ 96%] Building CXX object roofit/roostats/CMakeFiles/G__RooStats.dir/G__RooStats.cxx.o
[ 96%] Built target G__RooFitMore
[ 96%] Built target G__RooStats
make: *** [Makefile:156: all] Error 2
~/root/root-6.24.02/root_bld $               

If I ignore these errors and finish building ROOT, I can tab completing after typing TMVA:: and it gives an error followed (after a few seconds) by a list of options

root [0] TMVA::Error in <TInterpreter::TCling::AutoLoad>: failure loading library libTMVA.so for TMVA
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libTMVA.so for TMVA
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libTMVA.so for TMVA

AbsValue
AbsoluteDeviationLossFunction
AbsoluteDeviationLossFunctionBDT
ActionButton
BDT
etc...

Hi,
You can try to build with tmva-cuda=Off and see if it works and then later re-enable tmva-cuda. If you get the error only with tmva-cuda=On then it is due to the cuda building.
Which compiler version are you using and which standard C++, c++14 the default one ?

Okay, I changed my cmake command to

cmake . -Dall=ON -Dcuda=OFF -Dcudnn=OFF -Dtmva=ON -Dtmva-gpu=OFF -DCMAKE_CUDA_ARCHITECTURES="61" -DCMAKE_INSTALL_PREFIX=~/root/root-6.24.02-install

and it built properly and gave me no errors so it looks like there’s an issue with my CUDA installation. When I ran the cmake command it said gcc 11.1.0 and std=c++17.

I also ran

cmake .. -Dall=ON -Dcuda=ON -Dcudnn=ON -Dtmva=ON -Dtmva-gpu=OFF -DCMAKE_CUDA_ARCHITECTURES="61" -DCMAKE_INSTALL_PREFIX=~/root/root-6.24.02-install -DCMAKE_CUDA_STANDARD=17 -DCMAKE_CXX_STANDARD=17
make -j6

and it looks like it built fine, so the issue seems to come specifically from the setting -Dtmva-gpu=ON. I was able to install nvidia’s cuda samples and run some of them though, so I know cuda is working at least. I can’t seem to find a simple test to verify that cudnn is working properly, so maybe that’s part of the issue?

With the tmva-gpu set to ON it gets through a lot of building TMVA related stuff, but as soon as building the TMVA cuda stuff starts it falls apart. It starts with this output

[ 56%] Building CXX object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Reference/TensorDataLoader.cxx.o
[ 56%] Building CXX object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cpu.cxx.o
[ 56%] Building CXX object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cpu/CpuBuffer.cxx.o
[ 56%] Building CXX object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cpu/CpuMatrix.cxx.o
[ 56%] Building CXX object tmva/tmva/CMakeFiles/TMVA.dir/src/RBDT.cxx.o
[ 56%] Building CUDA object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cuda.cu.o
/home/markm/root/root-6.24.02-install/include/TStorage.h:131:37: warning: declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ with attribute ‘noinline’ follows inline declaration [-Wattributes]
  131 | R__NEVER_INLINE void TStorage::UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits) {
      |                                     ^~~~~~~~
/home/markm/root/root-6.24.02-install/include/TStorage.h:91:20: note: previous declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ here
   91 |    static void UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits);
      |                    ^~~~~~~~~~~~~~
[ 56%] Building CXX object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cuda/CudaBuffers.cxx.o
[ 56%] Building CUDA object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cuda/CudaMatrix.cu.o
/home/markm/root/root-6.24.02-install/include/TStorage.h:131:37: warning: declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ with attribute ‘noinline’ follows inline declaration [-Wattributes]
  131 | R__NEVER_INLINE void TStorage::UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits) {
      |                                     ^~~~~~~~
/home/markm/root/root-6.24.02-install/include/TStorage.h:91:20: note: previous declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ here
   91 |    static void UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits);
      |                    ^~~~~~~~~~~~~~
[ 56%] Building CUDA object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cuda/CudaTensor.cu.o
/home/markm/root/root-6.24.02-install/include/TStorage.h:131:37: warning: declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ with attribute ‘noinline’ follows inline declaration [-Wattributes]
  131 | R__NEVER_INLINE void TStorage::UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits) {
      |                                     ^~~~~~~~
/home/markm/root/root-6.24.02-install/include/TStorage.h:91:20: note: previous declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ here
   91 |    static void UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits);
      |                    ^~~~~~~~~~~~~~
[ 56%] Building CXX object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cudnn/TensorDataLoader.cxx.o
[ 56%] Building CUDA object tmva/tmva/CMakeFiles/TMVA.dir/src/DNN/Architectures/Cudnn.cu.o
/home/markm/root/root-6.24.02-install/include/TStorage.h:131:37: warning: declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ with attribute ‘noinline’ follows inline declaration [-Wattributes]
  131 | R__NEVER_INLINE void TStorage::UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits) {
      |                                     ^~~~~~~~
/home/markm/root/root-6.24.02-install/include/TStorage.h:91:20: note: previous declaration of ‘static void TStorage::UpdateIsOnHeap(const volatile UInt_t&, volatile UInt_t&)’ here
   91 |    static void UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits);
      |                    ^~~~~~~~~~~~~~

and then goes back to the same ‘std::__throw_bad_array_new_length()’ and exception_ptr issues as above once it hits the “Linking CXX shared library …/…/lib/libTMVA.so” step

I think there is some incompatibility with C++ version, C++ library version and cuda version.
Cuda is not compatible with gcc 11, normally you should get a cmake error from this (but it could be it depends on make version).
I would suggest you change the compiler to 9 or 10 and maybe also c++ std to c++14

On a machine with g++ version 11, I needed to configure root with:

-DCMAKE_CUDA_HOST_COMPILER="/usr/bin/gcc-9.3.0" -DCMAKE_CXX_COMPILER="/usr/bin/g++-9.3.
0" -DCMAKE_C_COMPILER="/usr/bin/gcc-9.3.0"

Thank you so much! This was the issue!
I set

-DCMAKE_CUDA_HOST_COMPILER="/usr/bin/gcc-10" -DCMAKE_CXX_COMPILER="/usr/bin/g++-10" 
-DCMAKE_C_COMPILER="/usr/bin/gcc-10"

and it worked. I tried to set the standard to c++14 but got an error saying that c++17 was needed so I stuck with that.

[ 36%] Copying /home/markm/root/root-6.24.02/icons/bld_undo.xpm
/usr/bin/cmake -E copy_if_different /home/markm/root/root-6.24.02/icons/bld_undo.xpm /home/markm/root/root-6.24.02/root_bld/icons/bld_undo.xpm
In file included from /home/markm/root/root-6.24.02/core/base/src/TROOT.cxx:120:
/home/markm/root/root-6.24.02-install/include/TClassEdit.h:159:4: warning: inline variables are only available with ‘-std=c++17’ or ‘-std=gnu++17’
  159 |    inline bool IsArtificial(std::string_view name) { return name.find('@') != name.npos; }
      |    ^~~~~~
/home/markm/root/root-6.24.02-install/include/TClassEdit.h:159:34: error: ‘string_view’ is not a member of ‘std’
  159 |    inline bool IsArtificial(std::string_view name) { return name.find('@') != name.npos; }
      |                                  ^~~~~~~~~~~
/home/markm/root/root-6.24.02-install/include/TClassEdit.h:159:34: note: ‘std::string_view’ is only available from C++17 onwards
/home/markm/root/root-6.24.02-install/include/TClassEdit.h:160:61: error: ‘bool TClassEdit::IsArtificial(ROOT::Internal::TStringView)’ redeclared as different kind of entity
  160 |    inline bool IsArtificial(ROOT::Internal::TStringView name) {return IsArtificial(std::string_view(name)); }
      |                                                             ^
/home/markm/root/root-6.24.02-install/include/TClassEdit.h:159:16: note: previous declaration ‘bool TClassEdit::IsArtificial’
  159 |    inline bool IsArtificial(std::string_view name) { return name.find('@') != name.npos; }
      |                ^~~~~~~~~~~~

The build worked and I was able to run the TMVA tutorial files with the DNN_GPU method so everything seems to be working fine