Skip to content

humble, jazzy: ament_cmake_gtest/gmock use conda-forge's gtest - #118

Draft
Tobias-Fischer wants to merge 2 commits into
mainfrom
ports/gtest-unvendor
Draft

Tobias-Fischer wants to merge 2 commits into
mainfrom
ports/gtest-unvendor

Conversation

@Tobias-Fischer

@Tobias-Fischer Tobias-Fischer commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

For humble and jazzy, the gtest version clash reported for kilted in RoboStack/ros-kilted#59.

Their ament_cmake_gtest builds gtest_vendor's sources (1.10 for humble, 1.14 for jazzy) into every package that uses ament_add_gtest/ament_add_gmock. It does that against the headers of conda-forge's gtest (now 1.18), which ament_cmake_gtest also depends on. So any such test fails to build, e.g. gtest-internal-inl.h: error: unknown … / no declaration matches testing::TestInfo::TestInfo(...). lyrical and rolling aren't affected: upstream ament_cmake 2.8+ dropped the vendored sources and uses find_package(GTest).

This backports that upstream change, like RoboStack/ros-kilted#100 does for kilted:

  • ament_cmake_gtest: _ament_cmake_gtest_find_gtest just find_package(GTest REQUIRED) + ament_find_gtest() on the GTest:: targets; the source-search block is removed.
  • ament_cmake_gmock: the same for gmock.

kilted's patches, adapted: the gtest one for humble's and jazzy's (identical) extras file, the gmock one as is for jazzy and without the ament_add_gmock_executable.cmake hunk for humble (which doesn't have that file).

gtest_vendor stays a dependency (vinca takes dependencies from the rosdistro), but nothing uses its sources any more.

Recipe test (shared/tests/ros2-ament-cmake-gmock.yaml): a minimal package with an ament_add_gtest and an ament_add_gmock test is built and both run. Checked both ways on humble osx-arm64: it passes with these patches, and fails to compile against the published humble packages (gtest_vendor's gtest-internal-inl.h: unknown type Int32).

Built and tested locally

  • humble, osx-arm64: ament_cmake_gtest and ament_cmake_gmock rebuilt with the patches. A minimal ament package with an ament_add_gtest and an ament_add_gmock test, in a fresh environment: before, the build fails compiling src/gtest_vendor; after, it finds conda-forge's GTest and both tests build and pass.
  • lyrical, osx-arm64 (for comparison, unpatched): the same package builds and passes.
  • jazzy, linux-64: ament_cmake_gtest and ament_cmake_gmock built with the patches, and the rest of that build (about 480 packages) on top of them. The minimal ament_add_gtest/ament_add_gmock package test was only run on humble.

Prepared on top of the current rosdistro syncs (#62 humble, #61 jazzy). CI is held with [skip ci]; merge after them. CI needs ament_cmake_gtest/ament_cmake_gmock evicted from the humble and jazzy build caches, if present.

🤖 Generated with Claude Code

Tobias-Fischer and others added 2 commits October 19, 2026 13:05
humble's and jazzy's ament_cmake_gtest compile gtest_vendor's sources
(1.10 / 1.14) in every package's test build, against the headers of
conda-forge's gtest (1.18), which ament_cmake_gtest also depends on: any
ament_add_gtest test fails to build ("no declaration matches
testing::TestInfo::TestInfo(...)", RoboStack/ros-kilted#59). lyrical and
rolling are fine: upstream ament_cmake 2.8+ dropped the vendored sources.

Backport that change (as RoboStack/ros-kilted#100 does for kilted):
_ament_cmake_gtest_find_gtest / _ament_cmake_gmock_find_gmock just
find_package(GTest) and use its targets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck test [skip ci]

Turns the local checks of this PR into a recipe test, so later rebuilds keep them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant