-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When MSGPACK_USE_BOOST=OFF installed headers still depend on Boost #1037
Comments
Thank you for reporting the issue. When you pass the flag Lines 68 to 82 in fb64ea0
And if MSGPACK_NO_BOOST is defined, chrono adaptor isn't included from msgpack-c/include/msgpack/type.hpp Lines 40 to 42 in fb64ea0
However, if you include chrono adaptor directly, you got the error. msgpack-c/include/msgpack/type.hpp Lines 72 to 78 in fb64ea0
But chrono is NOT a part of boost libraries, it is in the standard library. I will fix it soon. |
Added MSGPACK_NO_BOOST guard for direct inclusion of chrono adaptor,
Added MSGPACK_NO_BOOST guard for direct inclusion of chrono adaptor,
Could you try #1038 ? |
Sorry, I wouldn't be able to test it. |
No problem. I will release fixed version soon. |
@redboltz I come here from #1025 and #1005 because I realized this problem is probably caused by the same root cause :
From my understanding it feels like you should then hide this dependency from the msgpack-c final users rather than:
If you agree, I may be able to propose a PR for this or open a new issue to describe a potential solution to overcome the aforementioned issues. |
@flo-carrere , I'm not sure what you mean. Could you elaborate? MSGPACK_NO_BOOST is publish flag for users. See https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_configure#msgpack_no_boost--since-410 I'm not an expert of cmake. But if users want to use cmake and use msgpack-c as subproject, then MSGPACK_USE_BOOST=OFF can be used. msgpack-c is header only library so users don't need to link anyhing. (I mean archive) Maybe I misunderstand something. If creating PR is easier than explain by text, please send it but I can't promise it would be merged. It could be used for discussion base. |
@redboltz I understand, I'll try to be more specific. Firstly, I think all comes from #1001 where you isolated as much as you could the boost dependency from msgpack. More specifically on your questions:
The whole point here, is I think it is not acceptable to force the user to add this flag to their project. Why? Because it's a problem of encapsulation/coupling Having to define MSGPACK_NO_BOOST at the user level, means that msgpack fails to fulfill the promise. And its problems are actually progated above which is a bad thing. If this was acceptable, imagine a chain of two libraries A and B, A depending on B, B depending on msgpack. It would force either B to encapsulate properly msgpack or propagate again the error to A. Forcing A and B to define MSGPACK_NO_BOOST in their respective configuration to overcome the issue of msgpack at first as exposed above.
I agree (this is actually my case not using cmake) and by defining The reality is that it's just a more elegant way of providing the flag, but does not solve the issue which is it should not be defined at all as exposed above. And for non-CMake users, it makes no difference, which is a sign of this not addressing the real problem.
Creating a PR is definitely not easy (I don't have a full understanding yet).
It feels like to do this separation you kind of "forked boost" as part of #1001 and provided some sort of redirection headers techniques to select one version or another, defining sometimes "empty headers" to fill gaps and rely on a single inclusion hierarchy (it's probably too summed up here). Selection is internally based on What is problematic is when this selection is done on public headers -> meaning that if that public header is included on the user side it forces the user project to also resolve that selection -> leading to the problem.
In example (problem pointed by #1025):
The final To do this you either have to version the two flavors in some special place (may be a bit expensive but probably) or you could maybe rely on a templated version |
I think I just understood what is the biggest difference of our concept.
I disagree. msgpack-c has configuration preprosessor macros. msgpack-c user needs to care this configuration. This is a part of APIs(customization flags). The default value is provided but it is just default. User needs to understand what is the default value and can modify flags. msgpack-c's responsibility is that referring the flags and changing behavior as the flags expected. It is not only msgpack-c style. Many other C++ libraries e.g. Boost do the similar approach. |
Another important point.
This is opposite direction of C++ version of msgpack-c want to go. https://github.com/msgpack/msgpack-c/tree/cpp_master#usage
( I just found invalid This is very important. Configure should be by configurration macros as follows. No preprocessing by build system or package management system (e.g. cmake, automake, conan, vcpkg etc) execution must not enforced.
|
Don't misunderstand me, I agree with as many configuration flags as needed. I agree with MSGPACK_USE_BOOST for instance, it's a user choice and msgpack-c has then to provide the desired implementation according to. If internally, MSGPACK_NO_BOOST or whatever other flags is then defined as a consequence of a user choice, I agree. It's msgpack-c business to handle things correctly. What I disagree with is that the user is also forced to define some msgpack-c internal flags (like MSGPACK_NO_BOOST) to accomodate with msgpack-c "without boost" implementation. In that regard, I disagree with you stating that it is a configuration flag (despite it being in the list), to me it's just an internal/private flags and should remain as-is ideally. Rapidly replying on other configuration flags (like USE_LEGACY_FLOAT....) but it's outside the scope of this question to me:
OK this is a fair approach and in this case, there is no possibility to overcome the issue I'm pointing. I would have expected a little bit more encapsulation without compromising this too much as anyway msgpack-c is provided with a CMakelist.txt that handles configuration/preprocessing steps up to the installation step. It would just mean the installed version (after preprocessing) would be straitgh-forward. Not forcing any flag definition coupling in user code. |
For example, the installed file
include/msgpack/v1/adaptor/cpp11/chrono.hpp
includesboost/numeric/conversion/cast.hpp
without being conditional onMSGPACK_USE_BOOST
.Version: 4.1.2
FreeBSD 13.1
The text was updated successfully, but these errors were encountered: