Skip to content

Commit

Permalink
[CI] Build failures with ABSEIL 20240116 and CMAKE 3.30 (open-telemet…
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Jul 12, 2024
1 parent eb2b975 commit 63fa4fd
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
23 changes: 23 additions & 0 deletions ci/fix-abseil-cpp-issue-1536.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
commit 779a3565ac6c5b69dd1ab9183e500a27633117d5
Author: Derek Mauro <dmauro@google.com>
Date: Tue Jan 30 10:13:25 2024 -0800

Avoid export of testonly target absl::test_allocator in CMake builds

Closes #1536

PiperOrigin-RevId: 602764437
Change-Id: Ia5c20a3874262a2ddb8797f608af17d7e86dd6d6

diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt
index 449a2cad..ee9ca9c3 100644
--- a/absl/container/CMakeLists.txt
+++ b/absl/container/CMakeLists.txt
@@ -213,6 +213,7 @@ absl_cc_library(
DEPS
absl::config
GTest::gmock
+ TESTONLY
)

absl_cc_test(
37 changes: 37 additions & 0 deletions ci/install_abseil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ set -ex
export DEBIAN_FRONTEND=noninteractive
[ -z "${ABSEIL_CPP_VERSION}" ] && export ABSEIL_CPP_VERSION="20240116.1"

TOPDIR=`pwd`

BUILD_DIR=/tmp/
INSTALL_DIR=/usr/local/
pushd $BUILD_DIR
Expand All @@ -22,6 +24,41 @@ if [ ! -z "${CXX_STANDARD}" ]; then
ABSEIL_CPP_BUILD_OPTIONS=(${ABSEIL_CPP_BUILD_OPTIONS[@]} "-DCMAKE_CXX_STANDARD=${CXX_STANDARD}")
fi

#
# ABSEIL_CPP_VERSION="20240116.1" fails to build with CMake 3.30
# ABSEIL_CPP_VERSION="20240116.2" fails to build with CMake 3.30
# note that somehow the same builds with CMake 3.29.6
#
# Error reported:
# CMake Error at CMake/AbseilHelpers.cmake:317 (target_link_libraries):
# The link interface of target "test_allocator" contains:
#
# GTest::gmock
#
# but the target was not found. Possible reasons include:
#
# * There is a typo in the target name.
# * A find_package call is missing for an IMPORTED target.
# * An ALIAS target is missing.
#
# Call Stack (most recent call first):
# absl/container/CMakeLists.txt:206 (absl_cc_library)
#
# Root cause:
# https://github.com/abseil/abseil-cpp/pull/1536
#
# Applying fix from abseil commit 779a3565ac6c5b69dd1ab9183e500a27633117d5
#
# TODO(marcalff) Cleanup once abseil is upgraded to the next LTS


if [ "${ABSEIL_CPP_VERSION}" = "20240116.1" ] || [ "${ABSEIL_CPP_VERSION}" = "20240116.2" ]; then
echo "Patching abseil"
patch -p1 < ${TOPDIR}/ci/fix-abseil-cpp-issue-1536.patch
else
echo "Not patching abseil"
fi

mkdir build && pushd build
cmake "${ABSEIL_CPP_BUILD_OPTIONS[@]}" ..
make -j $(nproc)
Expand Down
4 changes: 2 additions & 2 deletions tools/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ fi
# No CRLF line endings, except Windows files.
"${SED[@]}" 's/\r$//' $($FIND -name '*.ps1' -prune -o \
-name '*.cmd' -prune -o -type f -print)
# No trailing spaces.
"${SED[@]}" 's/ \+$//' $($FIND -type f -print)
# No trailing spaces, except in patch.
"${SED[@]}" 's/ \+$//' $($FIND -name "*.patch" -prune -o -type f -print)

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

0 comments on commit 63fa4fd

Please sign in to comment.