Skip to content

Fix glibc detection#575

Open
Old-Ding wants to merge 1 commit into
ros2:rollingfrom
Old-Ding:codex/fix-glibc-detection
Open

Fix glibc detection#575
Old-Ding wants to merge 1 commit into
ros2:rollingfrom
Old-Ding:codex/fix-glibc-detection

Conversation

@Old-Ding

Copy link
Copy Markdown

Summary

  • Detect glibc through its __GLIBC__ identification macro instead of treating the non-unique backtrace() API as a proxy.
  • Propagate the actual check_c_source_compiles() result to the caller rather than the result variable's name.

Closes #574.

Why

Other C libraries can provide a compatible backtrace() implementation, so compiling that call does not prove that the compiler targets glibc. Additionally, the existing PARENT_SCOPE assignment stores the literal result variable name, preventing the caller from receiving the boolean compiler-test result.

Testing

  • Used an isolated CMake project with two synthetic libc headers. Before this change, both cases compiled and reported parent='<RESULT_VARIABLE>', including the non-glibc case.
  • After this change, the glibc case reports parent='1', cache='1'; the non-glibc case reports parent='', cache=''.
  • Parsed the helper with CMake 3.31.6 using cmake -P.
  • git diff origin/rolling...HEAD --check
  • Not run: the full rcutils package build, because this Windows workstation does not have the ROS 2/ament build dependencies installed.

The existing probe treats any libc with backtrace() as glibc and
propagates the result variable name instead of its value.

Check the glibc identification macro and return the actual compiler
test result to the caller.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>
@mergify

mergify Bot commented Jul 11, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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.

glibc detection is broken (patch included)

1 participant