Bug 2336266

Summary: abseil-cpp fails to build with GCC 15 (-Wtemplate-body or #include <cstdint> ?)
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: abseil-cppAssignee: Ben Beasley <code>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: code, richmattes
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: abseil-cpp-20240722.0-3.fc42 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-01-15 06:22:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2333037    

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.