ROOT Version: 6.25.01
Platform: Ubuntu 20.04.02
Compiler: GCC 9.3.0 and NVCC 11.4.1
Build Tools: CMake 3.16
Hi all,
It is noted in the ROOT build from source instructions that:
Starting with ROOT 6.20.06 it is possible to set
CMAKE_CXX_STANDARD
and CMAKE_CUDA_STANDARD` to different values to allow to compile ROOT with C++17 while CUDA code with C++14 when using CUDA 9 or 10.
I have succesfully installed ROOT with CXX_STANDARD of 17 and CUDA_STANDARD of 14. However, if I include any ROOT headers in .cu files I am met with compile-time errors like:
/usr/local/lib/root-6.25.01_install/include/ROOT/RStringView.hxx(90): error: expected an operator
/usr/local/lib/root-6.25.01_install/include/ROOT/RStringView.hxx(90): error: explicit type is missing (“int” assumed)
/usr/local/lib/root-6.25.01_install/include/TString.h(115): error: expected an operator
/usr/local/lib/root-6.25.01_install/include/TString.h(115): error: explicit type is missing (“int” assumed)
/usr/local/lib/root-6.25.01_install/include/TString.h(280): error: namespace “std” has no member “string_view”
I assume that this comes from trying to compile these files with an insufficient C++ standard.
I was wondering if anyone had advice as to how to resolve this problem. Some hypotheses/guiding questions I have are:
1.) I notice the instructions say use of mismatching cuda and cxx standards is possible for CUDA 9 or 10. I am using CUDA 11.4. Should I downgrade my CUDA to an earlier version to allow this?
2.) If I upgrade my CMake to a later version which supports CMAKE_CUDA_STANDARD of 17 can I compile both ROOT and CUDA with support for C++17?
3.) Is it possible that the issues above are not the result of mismatched CUDA and CXX standards? Are there any additional CMake flags I need to set at application compile time that I might be missing? I am able to compile CUDA libraries and link them to a ROOT containing project. My issue only occurs when I try to include ROOT headers in a .cu file.
Thank you for your help,
Joseph