[fix] Make cppzmq as public dependency to avoid linkage errors for tools #1043
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
This PR is a follow-up to #1027 and it's related to #1025
There is a scenario when using BehaviorTree.CPP and all its dependencies as shared libraries, and the option
BTCPP_BUILD_TOOLS=ONit will produce the following error:You can check my full build log for extra reference: behaviortree.cpp-4.8.2-linux-gcc11-shared-tools.log
It occurs because cppmzq is a header-only library whose implementation dependency (ZeroMQ) has its own shared library dependency (libsodium) that the linker cannot resolve transitively at link-time without explicit propagation due to
PRIVATE. Other dependencies are libraries, so their symbols or paths are properly encoded in the shared library metadata.When using external dependencies only, ZeroMQ is not listed as a direct dependency of BehaviorTree.CPP, because this project only consumes cppzmq, which has zeromq -> libsodium in its dependencies graph. And this is correct in terms of dependency management.
This PR fixes the current scenario by exposing cppzmq as PUBLIC, so its dependencies will be available when linking to:
You can check my full build log using this modification as well: behaviortree.cpp-4.8.3-dev-linux-gcc11-shared-tools.log
You can observe now that the libsodum location is exposed during the linkage stage, and zeromq can find its dependency.
Please, feel free to share your thoughts. Regards.
Environment
BehaviorTree.CPP version: 4.8.2
OS: GNU/Linux Ubunut 24.04
Compiler: GNU GCC 11