Skip to content

Fix backtrace call and variable setting in CMake#572

Open
AviaAv wants to merge 1 commit into
ros2:rollingfrom
AviaAv:fix-glibc-detection
Open

Fix backtrace call and variable setting in CMake#572
AviaAv wants to merge 1 commit into
ros2:rollingfrom
AviaAv:fix-glibc-detection

Conversation

@AviaAv
Copy link
Copy Markdown

@AviaAv AviaAv commented Jun 1, 2026

Description

Two likely issues in cmake/check_c_compiler_uses_glibc.cmake:

1. Type mismatch. backtrace(&buffer, size) passes void *(*)[1] where void ** is expected. On gcc >= 14 (default-error on -Wincompatible-pointer-types), the probe fails to compile on glibc. Fix: drop the &.

2. Result not propagated. set(${result_variable} ${result_variable} PARENT_SCOPE) looks like it's missing a $. In a small repro, if(USES_GLIBC) evaluates truthy regardless of probe outcome. Fix: ${${result_variable}}.

Is this user-facing behavior change?

Possibly. _GNU_SOURCE would only be defined when glibc is actually detected, and the configure log on gcc >= 14 + glibc would no longer print Performing Test USES_GLIBC - Failed.

Did you use Generative AI?

Yes. Claude Code helped diagnose and verify. I reviewed the changes myself.

Additional Information

Repro for 1: gcc -Werror=incompatible-pointer-types on the extracted snippet. Repro for 2: minimal CMakeLists.txt calling the function and printing ${USES_GLIBC}.

Signed-off-by: Avia Avraham <145359432+AviaAv@users.noreply.github.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