Bug 2336266 - abseil-cpp fails to build with GCC 15 (-Wtemplate-body or #include <cstdint> ?)
Summary: abseil-cpp fails to build with GCC 15 (-Wtemplate-body or #include <cstdint> ?)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: abseil-cpp
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ben Beasley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: gcc-15-mass-prebuild
TreeView+ depends on / blocked
 
Reported: 2025-01-07 22:54 UTC by Dave Malcolm
Modified: 2025-01-15 06:22 UTC (History)
2 users (show)

Fixed In Version: abseil-cpp-20240722.0-3.fc42
Clone Of:
Environment:
Last Closed: 2025-01-15 06:22:57 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dave Malcolm 2025-01-07 22:54:35 UTC
I'm experimentally rebuilding rawhide with the not-yet-released GCC 15 to see if anything breaks, and to help write the porting guide.  See https://fedoraproject.org/wiki/User:Dmalcolm/gcc-15

My test build with GCC 15 failed:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed/build/8476062/

whereas my test build with GCC 14 succeeded:
https://copr.fedorainfracloud.org/coprs/dmalcolm/gcc-15-smoketest-3.failed.checker/build/8477653/

Looking at the failure logs e.g.
https://download.copr.fedorainfracloud.org/results/dmalcolm/gcc-15-smoketest-3.failed/fedora-rawhide-x86_64/08476062-abseil-cpp/builder-live.log.gz

I see:

In file included from /builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/base/optimization.h:31,
                 from /builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/base/macros.h:36,
                 from /builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/memory/memory.h:33,
                 from /builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/container/internal/container_memory.h:28,
                 from /builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/container/internal/container_memory_test.cc:15:
/builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/container/internal/container_memory.h: In function 'void* absl::lts_20240722::container_internal::Allocate(Alloc*, size_t)':
/builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/container/internal/container_memory.h:66:27: error: 'uintptr_t' does not name a type [-Wtemplate-body]
   66 |   assert(reinterpret_cast<uintptr_t>(p) % Alignment == 0 &&
      |                           ^~~~~~~~~
/builddir/build/BUILD/abseil-cpp-20240722.0-build/abseil-cpp-20240722.0/absl/container/internal/container_memory.h:31:1: note: 'uintptr_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   30 | #include "absl/utility/utility.h"
  +++ |+#include <cstdint>
   31 | 

Looks like this header should have been explicitly included, but old versions of the C++ stdlib happened to do it for you, so it happened to work before.  Hopefully the fix is to simply add that #include.

Alternatively, see https://fedoraproject.org/wiki/User:Dmalcolm/gcc-15#C++:_error_with_-Wtemplate-body

Reproducible: Always

Comment 1 Ben Beasley 2025-01-08 12:34:41 UTC
Thank you for the heads-up! I think I remember that similar fixes have been required in the past. This is going to keep happening from time to time as long as upstream doesn’t practice include-what-you-use in general.

It looks like this has already been fixed upstream in https://github.com/abseil/abseil-cpp/pull/1739. I would have preferred a broader fix, at least one that included <cstdint> / <stdint.h> directly in each file that used uintptr_t / intptr_t, but assuming that the extremely narrow fix works for now, I won’t bother opening another upstream PR.

I’ll backport the fix via https://github.com/abseil/abseil-cpp/pull/1739.patch and test it against your COPR. Before I merge and build that, I need to finish analyzing, reporting, and skipping a test regression that’s showed up in Koschei recently on ppc64le. Still, expect to see a build closing this bug in the coming day or two.

Comment 2 Ben Beasley 2025-01-09 11:37:21 UTC
(In reply to Ben Beasley from comment #1)

> I’ll backport the fix via
> https://github.com/abseil/abseil-cpp/pull/1739.patch and test it against
> your COPR. Before I merge and build that, I need to finish analyzing,
> reporting, and skipping a test regression that’s showed up in Koschei
> recently on ppc64le. Still, expect to see a build closing this bug in the
> coming day or two.

I backported the fix, but I had trouble figuring out where I could actually test it against GCC 15. Would you please test https://src.fedoraproject.org/rpms/abseil-cpp/pull-request/23 and confirm that it resolves all GCC 15 regressions? Thanks!

Comment 3 Ben Beasley 2025-01-15 04:37:37 UTC
I’m testing this with a scratch build in the f42-build-side-10330 side tag, announced on the devel list as available for GCC 15 testing: https://koji.fedoraproject.org/koji/taskinfo?taskID=127880775

That seems to be succeeding, so I’m going to merge the PR ahead of the mass rebuild.

Comment 4 Fedora Update System 2025-01-15 05:03:25 UTC
FEDORA-2025-eb1b292e61 (abseil-cpp-20240722.0-3.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-eb1b292e61

Comment 5 Fedora Update System 2025-01-15 06:22:57 UTC
FEDORA-2025-eb1b292e61 (abseil-cpp-20240722.0-3.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.