You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, it doesn't seem to actually call this function anywhere - if the profile does not expliticly set compiler.cppstd, it simply errors out with
This doesn't match the documentation, or the behavior of the old (conan 1.x) conans.tools.check_min_cppstd, where such defaulting was also documented and did actually work.
test/1.0: Invalid: The compiler.cppstd is not defined for this configuration
I found a note at #11003 (comment) suggesting that the intent might have been to make cppstd compulsory, but if so that seemingly never happened - the default settings.yml is still happy to allow compiler.cppstd =null,
raiseConanInvalidConfiguration("The compiler.cppstd is not defined for this configuration")
in conan 2.3.1 that it does in conan 1.x
So it seems that either the code should support defaults (as its documentation says, and its predecessor did) or the documentation should at least not claim that it does. Preferably the former, since the documented behavior matches the old tools and seems desireable (there's really no reason validate() needs to fail if the compiler's defaults satisfy it...
======== Computing necessary packages ========
Requirements
test/0.1#12fed99e8a78e059aec5714f29af6be4:da39a3ee5e6b4b0d3255bfef95601890afd80709 - Invalid
ERROR: There are invalid packages:
test/0.1: Invalid: The compiler.cppstd is not defined for this configuration
The text was updated successfully, but these errors were encountered:
I think this is a docs bug, it totally looks like a copy & paste from legacy Conan 1 docs of that function. The docs in https://docs.conan.io/2/reference/tools/build.html#conan-tools-build-check-min-cppstd are generated from the docstring, and such docstring was copied verbatim from Conan 1). In Conan 2 it was never the intention to deduce cppstd from compiler version, but compiler.cppstd is recommended to be explicitly defined in most cases.
Now the docs at least match reality. I can certainly fix the failures by adding compiler.cppstd to all our profiles (like conan 2's default detection would have).
Now the docs at least match reality. I can certainly fix the failures by adding compiler.cppstd to all our profiles (like conan 2's default detection would have).
Sounds good, in Conan 2 it is expected that profiles define compiler.cppstd in most cases.
Describe the bug
https://docs.conan.io/2/reference/tools/build.html#conan-tools-build-check-min-cppstd says that check_*_cppstd should be able to infer the default cppstd from compiler.version in cases where it has not been overridden:
And does contain a function to derive this information
conan/conan/tools/build/cppstd.py
Line 78 in c233c62
However, it doesn't seem to actually call this function anywhere - if the profile does not expliticly set
compiler.cppstd
, it simply errors out withThis doesn't match the documentation, or the behavior of the old (conan 1.x) conans.tools.check_min_cppstd, where such defaulting was also documented and did actually work.
I found a note at #11003 (comment) suggesting that the intent might have been to make
cppstd
compulsory, but if so that seemingly never happened - the default settings.yml is still happy to allow compiler.cppstd =null,conan/conans/client/conf/__init__.py
Line 102 in c233c62
and this still causes the same
conan/conan/tools/build/cppstd.py
Lines 155 to 157 in c233c62
in conan 2.3.1 that it does in conan 1.x
So it seems that either the code should support defaults (as its documentation says, and its predecessor did) or the documentation should at least not claim that it does. Preferably the former, since the documented behavior matches the old tools and seems desireable (there's really no reason validate() needs to fail if the compiler's defaults satisfy it...
How to reproduce it
ubuntu 22.04 (11.4.0)
conan create .
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
======== Computing dependency graph ========
Graph root
cli
Requirements
test/0.1#12fed99e8a78e059aec5714f29af6be4 - Cache
======== Computing necessary packages ========
Requirements
test/0.1#12fed99e8a78e059aec5714f29af6be4:da39a3ee5e6b4b0d3255bfef95601890afd80709 - Invalid
ERROR: There are invalid packages:
test/0.1: Invalid: The compiler.cppstd is not defined for this configuration
The text was updated successfully, but these errors were encountered: