Skip to content

Conversation

ryanofsky
Copy link
Collaborator

@ryanofsky ryanofsky commented Apr 1, 2024

This change combines previous installed:

  • cmake/LibmultiprocessLibConfig.cmake
  • cmake/LibmultiprocessBinConfig.cmake

files into a single:

  • cmake/Libmultiprocess/LibmultiprocessConfig.cmake

file, so it can be imported with find_package(Libmultiprocess).

The previous locations which were set in #97 were not compatible with find_package search behavior by default.

The change also adds some documentation about using the new package to doc/install.md.

Move code and add comments, no substantive changes.
This change combines previous installed "cmake/LibmultiprocessLibConfig.cmake"
and "cmake/LibmultiprocessBinConfig.cmake" files into a single
"cmake/Libmultiprocess/LibmultiprocessConfig.cmake" file, so it can be imported
with "find_package(Libmultiprocess)". The previous locations which were set in
bitcoin-core#97 were not actually
compatible with find_package search behavior by default.

The change also adds some documentation about using the new package to
doc/install.md.
@ryanofsky
Copy link
Collaborator Author

Other comments about this

#97 (comment)
#95 (comment)
#97 (comment)
#95 (comment)
#97 (comment)

@hebasto
Copy link
Member

hebasto commented Apr 1, 2024

I did not test this PR yet, but have a question regarding the combined package configuration.

In the Bitcoin Core depends, how does it suppose to work considering that the mpgen tool is installed in the native subdirectory of the depends prefix?

@ryanofsky
Copy link
Collaborator Author

I'm not sure exactly, but I'd imagine you'd just find the package twice with different components instead of finding two packages separately. Even before this PR you would need to point cmake at the native directory to find the code generation package, so I don't think that aspect is changing.

@ryanofsky
Copy link
Collaborator Author

ryanofsky commented Apr 1, 2024

Or if the issue is that cmake doesn't allow importing two packages with the same name, maybe a good solution would be to add an option here controlling the installed package name.

If multiple libmultiprocess builds are installed (native and cross-compiled) it seems good if they are all allowed to be full installs, and downstream cmake projects can choose which components of each install to use. Even though depends system only does half-builds for efficiency (executable only or library only), this doesn't seem like something that should be required for other builds.

ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jun 13, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 11, 2024
depends: Update libmultiprocess library

Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 12, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 16, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 16, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 17, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in #95 and #96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 17, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in #95 and #96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in #95 and #96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in #95 and #96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 18, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
Sjors pushed a commit to Sjors/bitcoin that referenced this pull request Jul 19, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in #95 and #96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
fanquake added a commit to bitcoin/bitcoin that referenced this pull request Jul 20, 2024
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields)

Pull request description:

  Broken out of #30454 . Bumped [even further](4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream.

  hebasto Presumably this approach works now with the CMake branch?

ACKs for top commit:
  ryanofsky:
    Code review ACK d318c4e.

Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
@hebasto
Copy link
Member

hebasto commented Jul 20, 2024

I'm not sure exactly, but I'd imagine you'd just find the package twice with different components instead of finding two packages separately.

Once a package found, the ${PACKAGE}_DIR variable is cached.

Therefore, to work with Bitcoin Core's depends, the code as follows should be used:

find_package(Libmultiprocess COMPONENTS Lib)
unset(Libmultiprocess_DIR CACHE)
find_package(Libmultiprocess COMPONENTS Bin
  NO_CMAKE_FIND_ROOT_PATH
  PATHS ${CMAKE_FIND_ROOT_PATH}/native
)

But this approach undermines the user's ability to specify non-standard package component locations because the Libmultiprocess_DIR variable is overloaded.

Or if the issue is that cmake doesn't allow importing two packages with the same name, maybe a good solution would be to add an option here controlling the installed package name.

If such an option will be leveraged by depends, Bitcoin Core probably will fail to find the Libmultiprocess package provided by other means.

@ryanofsky
Copy link
Collaborator Author

re: #98 (comment)

@hebasto can you use the find_package NAMES option to give the packages different names? From the find_package documentation:

A cache entry called <PackageName>_DIR is created to hold the directory containing the file. By default, the command searches for a package with the name <PackageName>. If the NAMES option is given, the names following it are used instead of <PackageName>.

So modifying your example above, you could write:

find_package(Libmultiprocess COMPONENTS Lib)
find_package(LibmultiprocessNative COMPONENTS Bin
  NAMES Libmultiprocess
  NO_CMAKE_FIND_ROOT_PATH
  PATHS ${CMAKE_FIND_ROOT_PATH}/native
)

This should result in separate Libmultiprocess_DIR and LibmultiprocessNative_DIR variables

@hebasto
Copy link
Member

hebasto commented Jul 23, 2024

@ryanofsky

can you use the find_package NAMES option to give the packages different names? From the find_package documentation:

Thank you! The suggested approach looks nice to me.

It only requires a bugfix suggested in #103.

ryanofsky added a commit that referenced this pull request Jul 23, 2024
c373a94 cmake: Fix package configuration file (Hennadii Stepanov)

Pull request description:

  When loading a package configuration file, `find_package` defines variables to provide information about the call arguments. In particular, `CMAKE_FIND_PACKAGE_NAME` represents the package name.

  This PR uses this variable instead of a hardcoded name, making the use case suggested in #98 (comment) workable:
  ```cmake
  find_package(Libmultiprocess COMPONENTS Lib)
  find_package(LibmultiprocessNative COMPONENTS Bin
    NAMES Libmultiprocess
  )
  ```

ACKs for top commit:
  ryanofsky:
    Code review ACK c373a94

Tree-SHA512: 493cfd62c4992c9753772844c0a96004d45eb1c807986b7ce7871fdf0debede79d9f9fbe22ecce0a92d4d0b5a2d24f0067c2b5816f5210a8f5bcbb41d04fb917
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 24, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Jul 26, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
ryanofsky added a commit to ryanofsky/bitcoin that referenced this pull request Sep 26, 2024
Fix "connection: run async cleanups in LIFO not FIFO order"
bitcoin-core/libmultiprocess#101 is needed to prevent
CI failure https://cirrus-ci.com/task/4549686449668096 caused by wallet
processes deadlocking during shutdown when node process is killed.

This also includes other recent changes:

bitcoin-core/libmultiprocess#95: cmake: Introduce `LibmultiprocessMacros` module
bitcoin-core/libmultiprocess#96: cmake: Introduce packages
bitcoin-core/libmultiprocess#97: cmake: rename new packages and module introduced in bitcoin#95 and bitcoin#96
bitcoin-core/libmultiprocess#98: cmake: Combine installed packages
bitcoin-core/libmultiprocess#99: proxy-types: Fix missing space in server destroy log print
bitcoin-core/libmultiprocess#100: doc: Add various code comments and documentation
bitcoin-core/libmultiprocess#102: doc: Document shutdown sequences better
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 27, 2024
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields)

Pull request description:

  Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream.

  hebasto Presumably this approach works now with the CMake branch?

ACKs for top commit:
  ryanofsky:
    Code review ACK d318c4e.

Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 27, 2024
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields)

Pull request description:

  Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream.

  hebasto Presumably this approach works now with the CMake branch?

ACKs for top commit:
  ryanofsky:
    Code review ACK d318c4e.

Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 27, 2024
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields)

Pull request description:

  Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream.

  hebasto Presumably this approach works now with the CMake branch?

ACKs for top commit:
  ryanofsky:
    Code review ACK d318c4e.

Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 28, 2024
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields)

Pull request description:

  Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream.

  hebasto Presumably this approach works now with the CMake branch?

ACKs for top commit:
  ryanofsky:
    Code review ACK d318c4e.

Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 1, 2024
d318c4e depends: bump libmultiprocess for CMake fixes (Cory Fields)

Pull request description:

  Broken out of bitcoin#30454 . Bumped [even further](bitcoin@4883197#r1684802528) after bitcoin-core/libmultiprocess#98 was merged upstream.

  hebasto Presumably this approach works now with the CMake branch?

ACKs for top commit:
  ryanofsky:
    Code review ACK d318c4e.

Tree-SHA512: 4b5491f73c0063d09e8339829cd831b1f4c441dd7b55a22037c9337c80cce19bb00a3e5cf925efa77d6d4e89ab45482f40f5799bc14948f8cabcbad3c3549430
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Jul 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants