root icon indicating copy to clipboard operation
root copied to clipboard

Compilation issues with gcc 14.1.1, C++20, ROOT v6.30.06

Open wiechula opened this issue 9 months ago • 5 comments

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

wiechula avatar May 21 '24 14:05 wiechula

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?

guitargeek avatar May 21 '24 14:05 guitargeek

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:

  1. Build the 6.32 release candidate branch, where it works just fine https://github.com/root-project/root/tree/v6-32-00-patches

  2. Install and use GCC 13 with -DCMAKE_C_COMPILER=/usr/bin/gcc-13 -DCMAKE_CXX_COMPILER=/usr/bin/g++-13

guitargeek avatar May 21 '24 14:05 guitargeek

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.

wiechula avatar May 21 '24 19:05 wiechula

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!

guitargeek avatar May 22 '24 11:05 guitargeek

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!

wiechula avatar May 22 '24 17:05 wiechula