Build ROOT 6.26.04 module Core and std problem (ubuntu 22.04)

Hi. I have trouble with installing ROOT 6.26.04 on my ubuntu 22.04. I use cmake with that configurations:

cmake $options Druntime_cxxmodules=OFF -Dxrootd=0 -Dmemstat=0 -Dbuiltin_afterimage=0 -Dbuiltin_glew=0 -Dbuiltin_ftgl=0 -Dbuiltin_veccore=1 -Droofit=1 -Dunuran=1 -Dminuit2=1 -Dmathmore=1 -Dtmva=0 -Dfftw3=1 -Dvdt=0 -Dgenvector=1 -Dopengl=1 -Dsoversion=1 -Dexplicitlink=1 -DCMAKE_CXX_FLAGS=-D__ROOFIT_NOBANNER -DCMAKE_INSTALL_PREFIX=…/install $sources

Below I add error message. I will be grateful for any help.

> While building module 'Core':
> While building module 'std' imported from input_line_1:1:
> In file included from <module-includes>:76:
> /usr/include/c++/10/valarray:1214:5: error: exception specification in declaration does not match previous declaration
>     begin(valarray<_Tp>& __va) noexcept
>     ^
> /usr/include/c++/10/bits/range_access.h:107:31: note: previous declaration is here
>   template<typename _Tp> _Tp* begin(valarray<_Tp>&);
>                               ^
> While building module 'Core':
> While building module 'std' imported from input_line_1:1:
> In file included from <module-includes>:76:
> /usr/include/c++/10/valarray:1224:5: error: exception specification in declaration does not match previous declaration
>     begin(const valarray<_Tp>& __va) noexcept
>     ^
> /usr/include/c++/10/bits/range_access.h:108:37: note: previous declaration is here
>   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
>                                     ^
> While building module 'Core':
> While building module 'std' imported from input_line_1:1:
> In file included from <module-includes>:76:
> /usr/include/c++/10/valarray:1234:5: error: exception specification in declaration does not match previous declaration
>     end(valarray<_Tp>& __va) noexcept
>     ^
> /usr/include/c++/10/bits/range_access.h:109:31: note: previous declaration is here
>   template<typename _Tp> _Tp* end(valarray<_Tp>&);
>                               ^
> While building module 'Core':
> While building module 'std' imported from input_line_1:1:
> In file included from <module-includes>:76:
> /usr/include/c++/10/valarray:1249:5: error: exception specification in declaration does not match previous declaration
>     end(const valarray<_Tp>& __va) noexcept
>     ^
> /usr/include/c++/10/bits/range_access.h:110:37: note: previous declaration is here
>   template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
>                                     ^
> input_line_1:1:10: fatal error: could not build module 'std'
> #include <new>
>  ~~~~~~~~^
> Warning in cling::IncrementalParser::CheckABICompatibility():
>   Failed to extract C++ standard library version.
> While building module 'Core':
> While building module 'Cling_Runtime' imported from input_line_2:1:
> While building module 'Cling_Runtime_Extra' imported from /home/lukasz/Install/root/v6-26-04/build/etc/cling/Interpreter/RuntimeUniverse.h:27:
> In file included from <module-includes>:1:
> /home/lukasz/Install/root/v6-26-04/build/etc/cling/Interpreter/DynamicExprInfo.h:13:10: fatal error: could not build module 'std'
> #include <string>
>  ~~~~~~~~^
> /home/lukasz/Install/root/v6-26-04/build/etc/cling/Interpreter/RuntimeUniverse.h:27:10: fatal error: could not build module 'Cling_Runtime_Extra'
> #include "cling/Interpreter/Visibility.h"
>  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from input_line_3:1:
> In file included from /home/lukasz/Install/root/v6-26-04/build/etc/cling/lib/clang/9.0.1/include/assert.h:8:
> In file included from /usr/include/assert.h:35:
> In file included from /usr/include/features.h:510:
> /usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
> # include <gnu/stubs-32.h>
>           ^~~~~~~~~~~~~~~~
> While building module 'Core':
> While building module 'ROOT_Rtypes' imported from /home/lukasz/Install/root/v6-26-04/build/include/Rtypes.h:23:
> In file included from <module-includes>:1:
> /home/lukasz/Install/root/v6-26-04/build/include/RtypesCore.h:28:10: fatal error: could not build module 'std'
> #include <cstddef> // size_t, NULL
>  ~~~~~~~~^
> /home/lukasz/Install/root/v6-26-04/build/include/ThreadLocalStorage.h:60:10: fatal error: could not build module 'ROOT_Rtypes'
> #include "RtypesCore.h"
>  ~~~~~~~~^~~~~~~~~~~~~~
> While building module 'Core':
> While building module 'ROOT_Foundation_Stage1_NoRTTI' imported from /home/lukasz/Install/root/v6-26-04/build/include/Rtypes.h:195:
> In file included from <module-includes>:2:
> In file included from /home/lukasz/Install/root/v6-26-04/build/include/ROOT/RStringView.hxx:30:
> /usr/include/c++/10/experimental/string_view:41:10: fatal error: could not build module 'std'
> #include <string>
>  ~~~~~~~~^
> Error: Error loading the default rootcling header files.
> make[2]: *** [core/CMakeFiles/G__Core.dir/build.make:470: core/G__Core.cxx] Error 1
> make[1]: *** [CMakeFiles/Makefile2:23504: core/CMakeFiles/G__Core.dir/all] Error 2
> make[1]: *** Waiting for unfinished jobs....
> [ 76%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingRdictModuleFileExtension.cxx.o
> [ 76%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingTypedefInfo.cxx.o
> [ 76%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingTypeInfo.cxx.o
> [ 76%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingValue.cxx.o
> [ 76%] Built target MetaCling
> -- clad build command succeeded.  See also /home/lukasz/Install/root/v6-26-04/build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-build-*.log
> [ 76%] Performing install step for 'clad'
> -- clad install command succeeded.  See also /home/lukasz/Install/root/v6-26-04/build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-install-*.log
> [ 76%] Completed 'clad'
> [ 76%] Built target clad
> make: *** [Makefile:156: all] Error 2

ROOT Version: 6.26.04
Platform: ubuntu 20.04
Compiler: gcc

First, welcome to the ROOT Forum! Then, do you really need to build from source? Why don’t you take a pre-built binary or use conda?

Hi. I really prefer to build it from source.

Then I don’t know, maybe try with -DCMAKE_CXX_STANDARD=17. And if it doesn’t work, we may need help from @Axel , once he’s back next week

Where does the “/usr/include/c++/10” come from?
On Ubuntu 20.04, you should have “/usr/include/c++/9” (coming from :“libstdc++-9-dev”).
On Ubuntu 22.04, you should have “/usr/include/c++/11” (coming from :“libstdc++-11-dev”).

1 Like

Thanks for your advice, but -DCMAKE_CXX_STANDARD=17 did not work :confused:

OK, but can you check what @Wile_E_Coyote asked ?

Hello @bellenot and @Wile_E_Coyote,

I am working with @lukroz and can give more context.

The issue is that we need simultaneous installation of ROOT v5 and ROOT v6. ROOT v5 did not install with gcc 11, native to Ubuntu 22.04, so we’ve installed gcc 10 via alternatives. This allowed for installation of ROOT v5 and our experiment’s software which depends on it. Unfortunately ROOT v6-26-00 and 04 builds fail with gcc 10 even though these ROOT versions, with the same cmake options, build fine on Debian 11 with gcc 10.

The error is actually coming from the call to rootcling to generate G__Core.cxx

You could try to configure it adding:
-DCMAKE_C_COMPILER=/full/path/to/your/gcc10 -DCMAKE_CXX_COMPILER=/full/path/to/your/g++10

@Wile_E_Coyote thanks for your advice, unfortunately the result did not change :confused:

Does it affect rootcling?

When building your new ROOT 6, are you sure that nothing in your environment points to another ROOT version that you have (e.g., via “${ROOTSYS}” or “${PATH}” or “${LD_LIBRARY_PATH}” or “${PYTHONPATH}”)?

Yes, I am sure.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Turns out that this is a bug in libstdc++ :-/ There’s not much we can do about it; it has been fixed in updates of GCC, so updating your compiler might address this.

@Axel Maybe you could add some links to what you have found about it.

Phew. OK here you go :slight_smile:

https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2b2d97fc545635a0f6aa9c9ee3b017394bc494bf