-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[package] catch2/3.4.0: C++14 not compatible with C++20 #19008
Comments
It looks like, while previously difficult to support compatibility of a library across different Can anyone comment if this is the right approach to address this issue? If so then I'm happy to raise a PR. It looks like this is marked as experimental, but also appears to have been used in the doxygen recipe now, so it is safe to add to recipes? |
@Twon So far, we have been using check_max_cppstd You can find some recipes using it: https://github.com/search?q=repo%3Aconan-io%2Fconan-center-index+check_max_cppstd&type=code |
Thanks for the info @uilianries. I will take a look and have a go addressing this in the recipe. Many thanks! |
Re-visiting the issue, now I see better the problem. Catch2 has support to C++20 since 2020, so there is no reason for checking max cppstd version, sorry. The thing is, backward compatible cppstd is part of Conan design: https://docs.conan.io/2/reference/binary_model/custom_compatibility.html#customizing-the-binary-compatibility
It could be fixed by enforcing the compatibility in the recipe, but we avoid doing that to not break other recipes in ConanCenterIndex, it would create a missing dependency state. Another point is that only cppstd=14 is available in Conan Center: https://conan.io/center/recipes/catch2?version=3.5.0, but we should have 14, 17 and 20 available: https://github.com/conan-io/conan-center-index/blob/master/.c3i/config_v2.yml#L128C15-L128C15 So, I'll start an internal build to re-generate both catch2/3.5.0 and catch2/3.5.0 with all cppstd available. I should be enough to fix your problem. Meanwhile, you can re-build locally catch2 to keep the same cppstd version aligned. |
So I guess this will be fixed in conan 2.1? When it is out I can provide a PR adding |
Yeah, this is a big problem that I have tried to surface for many years now in the Community. It is nothing new for C++20. We had those issues already with C++17 when plenty of packages were using C++17 features or alternatives for older C++ versions. For example Setting of C++ standard do affect the ABI and having a different default is at least unsafe :-( |
BTW, with the official addition of Feature testing to C++, the problem is getting even more critical. Because it stops being dependent only on a C++ standard version but on each feature separately. See this code for example: However, it should already be covered if the above issues are addressed, as any C++ feature is dependent on the compiler type, its version, and a C++ standard version set. Package depending on feature test macros should always set |
I've updated PR to do just this now that Conan 2.1 is released. Please let me know if anything else is required and I can make any necessary changes to the PR. |
Thanks for your insights @mpusz! It's interesting how the standards committee and compiler vendors go through titanic efforts to avoid ABI breakages (w.r.t to the standard library) - my understand that one of the main reasons is to ensure that when using a new version of the standard, we can still link binaries that were built with an older version (with some exceptions). But if libraries are doing feature testing in public headers in a way that the expected symbols are different than the ones built into the libraries.. well, all efforts are moot. |
Hi @Twon, @hobbeshunter - I'm unable to reproduce the original issue, that is:
I can't get the link step to fail with any of the examples I'm trying - is there a minimal reproducing example that we can use as verification? Thanks! |
seems to do it :D |
Hi @jcar87, I have created a Github project with a minimal reproduction case: https://github.com/Twon/ConanCatch2IssueWithCxx17 Note, you will not see this error on Linux because it does not find pre-build packaged for Catch2, so builds them locally and hides the error. It can be reproduced on Windows as there are pre-build versions of the package. See this CI failure for an example: https://github.com/Twon/ConanCatch2IssueWithCxx17/actions/runs/8924838406/job/24512078018 Let me know if you need any further info. Thanks! |
Description
Conan thinks that a C++14 build of catch2 is compatible with a C++20 one. This is afaik wrong. E.g. the string_view support in StringMaker is missing.
Package and Environment Details
Conan profile
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
Steps to reproduce
Use catch2 in a C++20 project where it finds an already built C++14 package in the conan center. E.g. above profile.
Forcing a build with
--build=*
fixes the problem.Logs
When the following happens, you successfully reproduced the bug:
The text was updated successfully, but these errors were encountered: