Skip to content

Conversation

@theComputeKid
Copy link
Contributor

@theComputeKid theComputeKid commented Nov 28, 2025

  • On a config re-run, CMake will not check features again as it will read previously defined cache variables
  • Logic was difficult to follow, so refactored cxx_feature_check for simplicity

On CMake config first run:

Before (slow): checks all REGEX engines
After (fast): short circuits on first REGEX engine found.

On CMake config re-run:

Before (slow due to checks):

-- Google Benchmark version: v1.9.4, normalized to 1.9.4
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Performing Test HAVE_PTHREAD_AFFINITY -- failed to compile

After (fast as checks skipped): No output (as checks not performed)

Fixes #2078

@theComputeKid
Copy link
Contributor Author

theComputeKid commented Nov 28, 2025

@LebedevRI: Can you please re-trigger the CI? Is github having network issues?

error: failed retrieving file 'dos2unix-7.5.3-1-x86_64.pkg.tar.zst.sig' from ftp2.osuosl.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds

MacOS might have a genuine failure but Windows is having these issues.

Edit: Fixed MacOS failures by removing -D from add_compile_definitions(). Older versions of CMake do not automatically remove the -D.

- On a config re-run, CMake will not check features again as it will read previously defined cache variables.
- Logic was difficult to follow, so refactored `cxx_feature_check` for simplicity
@theComputeKid
Copy link
Contributor Author

theComputeKid commented Nov 28, 2025

It seems that there are intermittent failures already crept into main:

A quick look at the build-and-test workflow indicates that the pipeline is already failing tests that are showing up here as well on msys2, with the same user_counters_test or user_counters_test_tabular failing sporadically.

Based on this evidence, I believe that the failures are unrelated.

@LebedevRI: Can you please merge this and are the sporadic failures in main going to be investigated?

Copy link
Collaborator

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this AI-made?

if(DEFINED RUN_${FEATURE} AND RUN_${FEATURE} EQUAL 0)
message(STATUS "Performing Test ${FEATURE} -- success")
set(HAVE_${VAR} 1 PARENT_SCOPE)
add_definitions(-DHAVE_${VAR})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why what?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the line is only on the LHS of the diff, why this line and the other snippet being removed.
This literally renders this whole check pointless, since we no longer communicate it's results.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what you mean as the CACHE token here is communicating results at the parent scope:

set(${VAR} TRUE CACHE BOOL "" FORCE)

No other variables need to escape the function scope.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, HAVE_STD_REGEX, HAVE_GNU_POSIX_REGEX or HAVE_POSIX_REGEX are being properly propagated in my patch, depending on which REGEX engine is detected. If it wasn't, that file wouldn't compile with my changes and CI would fail.

As an example, in my local machine, it detects HAVE_STD_REGEX and does the right thing.

I am not sure I see the issue.

Copy link
Collaborator

@LebedevRI LebedevRI Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, HAVE_STD_REGEX, HAVE_GNU_POSIX_REGEX or HAVE_POSIX_REGEX are being properly propagated in my patch, depending on which REGEX engine is detected.

cmake cache variables - sure.

Preprocessor defines - no, they are not.
Could you please point me at where they are being set.

The answer i was looking for was: "are you illiterate or something, just on the line above, there's add_compile_definitions()".

If it wasn't, that file wouldn't compile with my changes and CI would fail.

This is not quite true, as you can see from that snippet, it has fallback defaults.

@theComputeKid
Copy link
Contributor Author

Is this AI-made?

No.

Copy link
Collaborator

@LebedevRI LebedevRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is probably fine.
@theComputeKid thank you!

@LebedevRI LebedevRI merged commit 6a8dee9 into google:main Nov 29, 2025
82 of 84 checks passed
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.

[BUG] Unneccesary re-run of cxx_feature_check on cmake config re-run

2 participants