conan-io / docs

conan.io reStructuredText documentation
http://docs.conan.io
MIT License
110 stars 360 forks source link

[bug] Order of options in profile is important(?) #3054

Open Nekto89 opened 2 years ago

Nekto89 commented 2 years ago

I don't know whether this is a bug or feature. For me this behavior looks strange. Reordering options in profile ([settings] section) may lead to ERROR.

Environment Details (include every applicable attribute)

Steps to reproduce (Include if Applicable)

1) check that default profile contains compiler and compiler version

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=17
build_type=Release
[options]
[build_requires]
[env]

2) Check that installation works on any package conan install -r conancenter utfcpp/3.2.1@ -pr:b=default -pr:h=default

3) Remove compiler from profile and add the same value. Conan will add this option to the end

conan profile remove settings.compiler default
conan profile update "settings.compiler=Visual Studio" default

4) Try installation with same options again

conan install -r conancenter utfcpp/3.2.1@ -pr:b=default -pr:h=default
ERROR: compiler not defined for compiler.version
Please define compiler value first too
czoido commented 2 years ago

Hi @Nekto89, Thanks for the question. In this case the order is important, because Conan reads the profile in one pass so if you are declaring a subsetting for a setting like compiler.version for compiler you must first declare that setting in the profile. I think this is something that probably we should document better so if you don't mind I will transfer this issue to the Conan docs repository.