Skip to content

cmake: Use proper build configuration during compiler/linker flag tests - #285

Merged
hebasto merged 3 commits into
cmake-stagingfrom
240725-cmake-HO
Aug 5, 2024
Merged

hebasto merged 3 commits into
cmake-stagingfrom
240725-cmake-HO

Conversation

@hebasto

@hebasto hebasto commented Jul 25, 2024

Copy link
Copy Markdown
Owner

This PR makes all compiler/linker flag tests use the following build configuration:

  • CMAKE_BUILD_TYPE with single-config generator, which means the same configuration during tests and the build.
  • the default configuration, which is "RelWithDebInfo", with multi-config generators.

Addresses the issue raised during today's CMake-WG call.

@hebasto

hebasto commented Jul 25, 2024

Copy link
Copy Markdown
Owner Author

cc @fanquake @TheCharlatan @theuni

@hebasto hebasto added the bug Something isn't working label Jul 25, 2024
@theuni

theuni commented Jul 30, 2024

Copy link
Copy Markdown

Lol. See comment here: #282 (comment)

I just came to the exact same conclusion :)

@theuni theuni left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

utACK other than the doc request.

if(is_multi_config)
get_property(help_string CACHE CMAKE_CONFIGURATION_TYPES PROPERTY HELPSTRING)
set(CMAKE_CONFIGURATION_TYPES "${all_configs}" CACHE STRING "${help_string}" FORCE)
set(CMAKE_TRY_COMPILE_CONFIGURATION "${config}" PARENT_SCOPE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you add a link to this here? This is arguably a bug that will likely be fixed in the future.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Thanks! Done.

@m3dwards

m3dwards commented Jul 31, 2024 •

Copy link
Copy Markdown

ACK 60d061a

Before PR with single config generators different flags were passed to TRY_COMPILE steps and after PR they matched. With multi config generators (I tested with Ninja) and before PR applied, no flags associated with build type were used with TRY_COMPILE steps. After PR - flags associated with RelWithDebInfo were seen.

It is worth noting that there is an (unavoidable?) subtle difference now between single config generator and multi config generators in that single config generators will align TRY_COMPILE flags with the actual compile flags. Whereas multi config generators will use different flags at compile time depending on build type selected and always flags associated with RelWithDebInfo for configuration time TRY_COMPILE checks.

@hebasto

hebasto commented Jul 31, 2024

Copy link
Copy Markdown
Owner Author

Rebased due to the recent sync/rebase cycle.

@m3dwards

Copy link
Copy Markdown

reACK e51c781

@theuni

theuni commented Jul 31, 2024

Copy link
Copy Markdown

It is worth noting that there is an (unavoidable?) subtle difference now between single config generator and multi config generators in that single config generators will align TRY_COMPILE flags with the actual compile flags. Whereas multi config generators will use different flags at compile time depending on build type selected and always flags associated with RelWithDebInfo for configuration time TRY_COMPILE checks.

Agree this is annoying, but it's unfortunately just how CMake works. The lead dev says as much in the issue linked above. Ideally multi-config would do checks for each type (and even more ideally, in parallel), but this is just how it is for now I'm afraid.

@theuni theuni left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

utACK. I haven't tested, but this is what I expected.

@hebasto
hebasto merged commit ef16073 into cmake-staging Aug 5, 2024
hebasto pushed a commit that referenced this pull request Jul 7, 2026
….makePool` method

6b0a907 Squashed 'src/ipc/libmultiprocess/' changes from 3edbe8f..16bf05d (Ryan Ofsky)

Pull request description:

  The changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh).

  Changes since last subtree update (bitcoin#34977):

  - Adds `makePool` method on `ThreadMap` to support thread pool routing, allowing requests without a specific client thread to be dispatched to a pool using a shortest-queue strategy ([#283](bitcoin-core/libmultiprocess#283)).
  - Adds `std::unordered_set` support, a `BuildList` helper, and a `ReadList` helper to reduce duplication in list build and read handlers ([#277](bitcoin-core/libmultiprocess#277), [#285](bitcoin-core/libmultiprocess#285)).
  - Adds support for translating C++ `std::optional<T>` struct fields to pairs of `T` + `hasT :Bool` Cap'n Proto struct fields, allowing unset optional primitive fields to be represented ([#243](bitcoin-core/libmultiprocess#243)).
  - Produces more readable log output for Proxy object lifecycle events and IPC server-side failures ([#218](bitcoin-core/libmultiprocess#218)).
  - Handles exceptions thrown by `destroy` methods by logging instead of aborting ([#273](bitcoin-core/libmultiprocess#273)). This can prevent server crashes when non-libmultiprocess clients disconnect without destroying objects, in the case where a server object owns client objects and the server destructor tries to call the disconnected client to free them ([#219](bitcoin-core/libmultiprocess#219)).
  - Handles unexpected exceptions thrown by callbacks (that should never happen) by logging errors instead of deadlocking ([#260](bitcoin-core/libmultiprocess#260)).
  - Fixes a rare mptest hang on musl builds caused by a lost wakeup bug in `Waiter` ([#295](bitcoin-core/libmultiprocess#295)).
  - Fixes a race condition in a log print detected by TSan ([#286](bitcoin-core/libmultiprocess#286)).
  - Build improvements: makes `target_capnp_sources` work correctly when libmultiprocess is used as a CMake subproject ([#289](bitcoin-core/libmultiprocess#289)), adds `mp_headers` target for better lint tool support ([#291](bitcoin-core/libmultiprocess#291)), and fixes compatibility with recent Nix and CMake 4.0 ([#238](bitcoin-core/libmultiprocess#238)).
  - Test, CI, documentation, and minor code improvements: design document corrections ([#278](bitcoin-core/libmultiprocess#278)), field constant comments ([#279](bitcoin-core/libmultiprocess#279)), clang-tidy fix ([#292](bitcoin-core/libmultiprocess#292)), new smoke test for double-precision float values ([#294](bitcoin-core/libmultiprocess#294)), new test for recursive async IPC calls ([#301](bitcoin-core/libmultiprocess#301)), removal of libevent from Core CI builds ([#299](bitcoin-core/libmultiprocess#299)), and rename of `EventLoop::m_num_clients` to `m_num_refs` ([#302](bitcoin-core/libmultiprocess#302)).

ACKs for top commit:
  fanquake:
    ACK 02afa66
  hebasto:
    ACK 02afa66.

Tree-SHA512: ef81a951c971f328a0a98436030467eeea30925eb6016eafd9bc7a25726c87628a852bbb1d84b88bce340aeea2bed25c65bc55db1168ebcb850628cd18808883
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants