Skip to content

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

@OleksandrKvl

Description

@OleksandrKvl

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?

6c1f120

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:

#define _XOPEN_SOURCE 500 // Exposes definitions for SUSv2 (UNIX 98).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions