[Bug]: Can't build on macOS with GCC 15

Open Beginner friendly
#2,027 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
cmake, cpp
Domain
build-system

Research direction

The issue is in absl/time/internal/cctz/src/time_zone_format.cc at line 25, where a macro definition might conflict with GCC 15 headers. Start by reproducing the build failure on macOS with GCC 15, then examine the macro definitions around that line and their interaction with the C++ standard library headers. The fix likely involves adjusting preprocessor conditions to avoid the conflict. Verify by building the time_zone target after the change.

Written by the indexing model from the issue text.

Description

Describe the issue

Failed to build abseil via Conan or directly from git using GCC-15 installed via brew. The error is:

[build] FAILED: [code=1] absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_format.cc.o 
[build] /opt/homebrew/bin/g++-15  -I/Users/alex/Documents/src/abseil-cpp -g -arch arm64 -Wall -Wextra -Wcast-qual -Wconversion-null -Wformat-security -Wmissing-declarations -Wnon-virtual-dtor -Woverlength-strings -Wpointer-arith -Wundef -Wunused-local-typedefs -Wunused-result -Wvarargs -Wvla -Wwrite-strings -DNOMINMAX -MD -MT absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_format.cc.o -MF absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_format.cc.o.d -o absl/time/CMakeFiles/time_zone.dir/internal/cctz/src/time_zone_format.cc.o -c /Users/alex/Documents/src/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc
[build] In file included from /opt/homebrew/Cellar/gcc/15.2.0_1/include/c++/15/ext/string_conversions.h:45,
[build]                  from /opt/homebrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/basic_string.h:4444,
[build]                  from /opt/homebrew/Cellar/gcc/15.2.0_1/include/c++/15/string:56,
[build]                  from /Users/alex/Documents/src/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h:27,
[build]                  from /Users/alex/Documents/src/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc:30:
[build] /opt/homebrew/Cellar/gcc/15.2.0_1/include/c++/15/cstdlib:147:11: error: 'at_quick_exit' has not been declared in '::'
[build]   147 |   using ::at_quick_exit;
[build]       |           ^~~~~~~~~~~~~
[build] /opt/homebrew/Cellar/gcc/15.2.0_1/include/c++/15/cstdlib:170:11: error: 'quick_exit' has not been declared in '::'
[build]   170 |   using ::quick_exit;
[build]       |           ^~~~~~~~~~
Steps to reproduce the problem

Build abseil via CMake.

What version of Abseil are you using?

6c1f120e3e50ef38a3b3d6e088139f271ea9cc79

What operating system and version are you using?

macOS Sequoia 15.7.4

What compiler and version are you using?

gcc-15 (Homebrew GCC 15.2.0_1) 15.2.0

What build system are you using?

CMake 4.3.0

Additional context

Google suggested that the error might be related to _XOPEN_SOURCE macro being defined. The build succeeded when I commented it out here: https://github.com/abseil/abseil-cpp/blob/9cc7e8dbd54a60096ed056638cb0128fb6018fb4/absl/time/internal/cctz/src/time_zone_format.cc#L25

Dominant language
C++
Stars
18.1k
Forks
3.2k
Avg merge
12h 35m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abseil/abseil-cpp

All issues in abseil/abseil-cpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.