Compilation issues with gcc 14.1.1, C++20, ROOT v6.30.06
Check duplicate issues.
- [X] Checked for duplicates
Description
After updating from gcc 13.2.1 to gcc 14.1.1 I get several compile errors starting with e.g.
While building module 'Core':
While building module 'std' imported from input_line_1:1:
In file included from <module-includes>:10:
In file included from /usr/include/c++/14.1.1/chrono:49:
In file included from /usr/include/c++/14.1.1/bits/shared_ptr.h:53:
In file included from /usr/include/c++/14.1.1/bits/shared_ptr_base.h:66:
/usr/include/c++/14.1.1/bits/align.h:93:21: error: call to 'has_single_bit' is ambiguous
static_assert(std::has_single_bit(_Align));
^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14.1.1/bit:439:5: note: candidate function [with _Tp = unsigned long]
has_single_bit(_Tp __x) noexcept
^
The full log is install.txt
Reproducer
git clone https://github.com/root-project/root.git
cd root/
git checkout v6-30-06
mkdir build install
cd build
cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_CXX_STANDARD=20 ../
cmake --build . --target install -j 12 &> install.txt
ROOT version
v6-30-06
Installation method
from source
Operating system
Linux (arch linux)
Additional context
No response
You're using ArchLinux, where ROOT 6.30.06 is part of the official system packages: https://archlinux.org/packages/extra/x86_64/root/
If you look at the linked packages sources and do exactly as in the PKGBUILD, your build will succeed:
https://gitlab.archlinux.org/archlinux/packaging/packages/root
I think getting the right settings.cmake is important. Maybe for your particular problem, the cxxmodules=OFF part of it is the solution?
Ah, now that I tried it: I see that it doesn't work, also with the official config!
So you have two easy options until someone fixes this issue:
-
Build the 6.32 release candidate branch, where it works just fine https://github.com/root-project/root/tree/v6-32-00-patches
-
Install and use GCC 13 with
-DCMAKE_C_COMPILER=/usr/bin/gcc-13 -DCMAKE_CXX_COMPILER=/usr/bin/g++-13
Dear @guitargeek , thanks a lot for your fast feedback! Indeed, v6-32-00-patches builds fine. I'm building root as part of the ALICE software stack with custom build options. Using pre-packaged versions will not work.
Hi! I didn't get from your answer if the workaround of using 6.32 or an older compiler is unblocking your work. Can you please clarify? That will help to assess the priority of this issue. Thanks!
After adjusting some parts of our software to modifications made in v6.32 I manage to compile the full stack. So for me this is fine for the moment. Thanks again for you support!
If it works in master (that one I tested some time ago with a release candidate of GCC 14) and v6-32-00-patches, then it's likely that the upgrade to LLVM + Clang 16.0 is needed to parse the libstdc++ headers. It might be possible to identify and backport a patch to v6-30-00-patches and its LLVM + Clang 13.0, but I'd rather avoid that if possible. In general ROOT only supports the latest compilers with the latest release (granted, 6.32 isn't out yet...)
Clarified.