Skip to content

Commit 63fa4fd

Browse files
authored
[CI] Build failures with ABSEIL 20240116 and CMAKE 3.30 (#3002)
1 parent eb2b975 commit 63fa4fd

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

ci/fix-abseil-cpp-issue-1536.patch

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
commit 779a3565ac6c5b69dd1ab9183e500a27633117d5
2+
Author: Derek Mauro <[email protected]>
3+
Date: Tue Jan 30 10:13:25 2024 -0800
4+
5+
Avoid export of testonly target absl::test_allocator in CMake builds
6+
7+
Closes #1536
8+
9+
PiperOrigin-RevId: 602764437
10+
Change-Id: Ia5c20a3874262a2ddb8797f608af17d7e86dd6d6
11+
12+
diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt
13+
index 449a2cad..ee9ca9c3 100644
14+
--- a/absl/container/CMakeLists.txt
15+
+++ b/absl/container/CMakeLists.txt
16+
@@ -213,6 +213,7 @@ absl_cc_library(
17+
DEPS
18+
absl::config
19+
GTest::gmock
20+
+ TESTONLY
21+
)
22+
23+
absl_cc_test(

ci/install_abseil.sh

+37
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ set -ex
77
export DEBIAN_FRONTEND=noninteractive
88
[ -z "${ABSEIL_CPP_VERSION}" ] && export ABSEIL_CPP_VERSION="20240116.1"
99

10+
TOPDIR=`pwd`
11+
1012
BUILD_DIR=/tmp/
1113
INSTALL_DIR=/usr/local/
1214
pushd $BUILD_DIR
@@ -22,6 +24,41 @@ if [ ! -z "${CXX_STANDARD}" ]; then
2224
ABSEIL_CPP_BUILD_OPTIONS=(${ABSEIL_CPP_BUILD_OPTIONS[@]} "-DCMAKE_CXX_STANDARD=${CXX_STANDARD}")
2325
fi
2426

27+
#
28+
# ABSEIL_CPP_VERSION="20240116.1" fails to build with CMake 3.30
29+
# ABSEIL_CPP_VERSION="20240116.2" fails to build with CMake 3.30
30+
# note that somehow the same builds with CMake 3.29.6
31+
#
32+
# Error reported:
33+
# CMake Error at CMake/AbseilHelpers.cmake:317 (target_link_libraries):
34+
# The link interface of target "test_allocator" contains:
35+
#
36+
# GTest::gmock
37+
#
38+
# but the target was not found. Possible reasons include:
39+
#
40+
# * There is a typo in the target name.
41+
# * A find_package call is missing for an IMPORTED target.
42+
# * An ALIAS target is missing.
43+
#
44+
# Call Stack (most recent call first):
45+
# absl/container/CMakeLists.txt:206 (absl_cc_library)
46+
#
47+
# Root cause:
48+
# https://github.com/abseil/abseil-cpp/pull/1536
49+
#
50+
# Applying fix from abseil commit 779a3565ac6c5b69dd1ab9183e500a27633117d5
51+
#
52+
# TODO(marcalff) Cleanup once abseil is upgraded to the next LTS
53+
54+
55+
if [ "${ABSEIL_CPP_VERSION}" = "20240116.1" ] || [ "${ABSEIL_CPP_VERSION}" = "20240116.2" ]; then
56+
echo "Patching abseil"
57+
patch -p1 < ${TOPDIR}/ci/fix-abseil-cpp-issue-1536.patch
58+
else
59+
echo "Not patching abseil"
60+
fi
61+
2562
mkdir build && pushd build
2663
cmake "${ABSEIL_CPP_BUILD_OPTIONS[@]}" ..
2764
make -j $(nproc)

tools/format.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ fi
2323
# No CRLF line endings, except Windows files.
2424
"${SED[@]}" 's/\r$//' $($FIND -name '*.ps1' -prune -o \
2525
-name '*.cmd' -prune -o -type f -print)
26-
# No trailing spaces.
27-
"${SED[@]}" 's/ \+$//' $($FIND -type f -print)
26+
# No trailing spaces, except in patch.
27+
"${SED[@]}" 's/ \+$//' $($FIND -name "*.patch" -prune -o -type f -print)
2828

2929
# If not overridden, try to use clang-format-18 or clang-format.
3030
if [[ -z "$CLANG_FORMAT" ]]; then

0 commit comments

Comments
 (0)