-
Notifications
You must be signed in to change notification settings - Fork 989
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
Revise Cppstd compatibility model #6157
Comments
We are revising our approach to Conan-ify our repositories (and find out we have been doing several things wrong, see the #6176 you already linked ; ) In our opinion, the C++ standard should likely still introduce package-variability by defaut (i.e., change the package ID). Even though it was very instructive to read the linked SO answer regarding the major 3 compilers, it might not be future proof to remove
It feels like Conan should map its model on the standard, not on specific implementations, so we think your model is accurate here : ) You also make the argument that some recipe might pretend to use this setting (by declaring it in the Taking a step back, maybe this is a more general problem, and probably a tricky one. As we understand the current model, Conan recipes define package-variability via settings and options. Through that, the Conan tool offers highly consistent build of a project alongside its complete dependency graph. It is very easy for the recipe to lie about that: novice recipe implementers (as ourselves) will not always properly forward the variability. Conan provides a great Python Yet, we are reluctant to use this macro for a few reasons:
In our situation, we ended up with just some of the settings/options forwarded (the one that the Maybe this actual discussion regarding the |
This new blog post by @christoph-cullmann is very interesting: https://cullmann.io/posts/cpp-standard-version-mix-up/ They found a binary incompatibility in Windows MSVC for c++14 and c++17. Seems our hypothesis that C++ std should be consistent among dependencies holds at least for Windows MSVC. |
As a feedback to @Adnn, yes we agree with your comments. This is the reason we are trying to move to a "toolchain" approach: #5919, less invasive and under control directly from Conan recipes, not inside generated CMake scripts. I think you want to track that effort and indeed it seems the Cppstd is something that could also be managed directly in the toolchain. |
The problem I found could be even worked around if LLVM would move the implementation of the alloc/dealloc functions to a .cpp file instead of having them inline in the .h including the feature check macros. There is more incompatible stuff lurking regarding alignment, thought, that is not that easy to fix, beside disabling the Zc:alignedNew stuff if you mix pre-17 with 17 stuff, see: https://docs.microsoft.com/en-us/cpp/build/reference/zc-alignednew?view=vs-2019 |
Thanks very much for the info. Yes, this seems to indicate that the default Conan model of assuming that binaries generated with different Thanks again for the info and the interesting blog post! |
supporting multiple C++ standards by library might be challenging. usually, each standard library feature goes into C++ standard via its own life-cycle. typical example of such life-cycle:
given the above, library trying to support builds for different C++ standards often need to adapt, detecting available compiler features and use various implementations: own implementation, boost/3rd-party implementation, experimental implementation or final implementation, depending on compiler and flags. in that way, even if compiler itself keeps backward compatibility between various C++ language standards, you can't safely mix random libraries built for various standards. in that way, it's easy to get situation when implementation expected that's the reason why few real-life examples: |
Thanks @SSE4 for this post, however it seems that while this means that if i want to mix cppstd I cannot do this on consumer recipes but rather the recipes that have some restrictions on cppstd themselves, this works, and is probably what I will go with personally so something like ..
Alternatively this can be hacked around by providing a dummy option that propagates into settings something like..
Oh well, I'll think about this and chose between these two, but both of them are pretty bad - as they require change of the source conanfile.py |
Related to the conan-io/conan-center-index#54 |
Hi! During the last days I've been thinking about this issue and I've prepared a POC modifying some Conan behavior to propose an implementation to deal with the Big disclaimer.- This is something to think about, it can be very risky to assume ABI compatibility among different standards, different libraries and different vendors,... Maybe it is better for Conan to provide tools and let the users do their best. Main ideas:
Issues along the way:
The proposal:
I would love to hear your feedback. Thanks! |
some random notes on @jgsogo feedback
I don't think it's safe use-case. if library used e.g. for the other things suggested, I personally find it very complicated, I would personally use Occam's razor here - don't add new exceptions, compatibility modes, etc., unless really needed. from my point of view it is:
or the second one:
both cases are strongly discouraged IMO, and only for very experienced users (not a generic thing to be recommended for daily usage). for most of usages we should assume by default that C++ standards aren't compatible across random recipes. |
I've commented on the idea in private, here my general points.
I think that the While I do understand that we'd very much like to have more friendly defaults for compatibility issues - the problem is the same as with package_id_modes for different library types. It depends on many things that Conan ideally should support and resolve natively, but it's too complex to do now. |
Quick note: any ABI compatibility between C++ standards will require other settings to be the same (all the |
I've made a tool solution to the conan/conans/client/tools/settings.py Line 271 in e642aef
|
at the moment, we are going to try to generate more binaries for different cppstd in ConanCenter, and leaving the current default model in Conan, which is one binary per cppstd, which is the most robust and safe. Not doing nothing now for Conan 1.26, removing from milestone. |
Some new discussion around this in: conan-io/hooks#342 |
Abseil has replacements for a few C++ standard elements (most notable std::string_view) so when it is built in C++11 mode compiles its own, but when built in C++17 mode uses the standard type. |
For alpha7 we are trying to implement a mechanism for the compatibility.py for the |
Closed by #11095 Conan 2.0 implements a default |
There are recipes out there, even merge to Conan-center-index like this
Absent is activating the c++17 standard in the CmakeLists.txt, but it is not defined in any input.
The recipe is doing tricks as:
To check if the compiler provides capabilities for that C++ standard. But cppstd is not there at all.
It can be deduced that in reality different C++ standards for the same compiler version are binary compatible:
In that case, our model would be inaccurate. Maybe we should:
package_info()
helpers to define compatibility between them, or do erasure of the input setting.Comes from https://github.com/conan-io/conan/pull/5997/files cc / @uilianries
The text was updated successfully, but these errors were encountered: