Skip to content

Fix C++ CMake build on Ubuntu 26.04 (Boost >= 1.89 and Abseil deprecated-declarations) - #4099

Merged
kkeshava merged 2 commits into
masterfrom
kkeshava_fix_cpp_build
Nov 5, 2026
Merged

kkeshava merged 2 commits into
masterfrom
kkeshava_fix_cpp_build

Conversation

@kkeshava

@kkeshava kkeshava commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor
  1. On Ubuntu 26.04, libre2-dev pulls in libabsl-dev (Abseil 20260107.0), so find_package(absl) in CMakeLists.txt uses the system Abseil. In this Abseil version, the pointer constructor absl::MutexLock(absl::Mutex*) is marked [[deprecated("Use the constructor that takes a reference instead")]]. Because CMakeLists.txt sets:

if (NOT WIN32)
add_definitions ("-Wall -Werror")
endif ()

compiling PhoneNumberOfflineGeocoder::~PhoneNumberOfflineGeocoder (line 80) and PhoneNumberOfflineGeocoder::GetAreaDescription (line 198) fails on absl::MutexLock l(&mu_); with:

error: ‘absl::debian7::MutexLock::MutexLock(absl::debian7::Mutex*)’ is deprecated: Use the constructor that takes a reference instead [-Werror=deprecated-declarations]

Fix for Build C++: In CMakeLists.txt, add -Wno-deprecated-declarations (the same flag used to build locally in opensource_metadata):

if (NOT WIN32)
add_definitions ("-Wall -Werror -Wno-deprecated-declarations")
endif ()

(Note: Using -Wno-deprecated-declarations in CMakeLists.txt is safer than changing absl::MutexLock l(&mu_); to absl::MutexLock l(mu_); in phonenumber_offline_geocoder.cc, because when absl is not installed on the system, CMakeLists.txt falls back to fetching Abseil 273292d from 2021, which only has the pointer constructor MutexLock(Mutex).)*

  1. In cpp/test/phonenumbers/phonenumberutil_test.cc, line 1636 already passes the escaped UTF-8 bytes "(650) 253-0000\xE2\x80\x8F", while the comment on line 1637 contained a raw, unescaped U+200F character. So removing the raw U+200F comment.

@kkeshava
kkeshava requested a review from a team as a code owner November 5, 2026 10:33
@kkeshava
kkeshava merged commit 743a335 into master Nov 5, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants