conan: [bug] "conan profile detect" detects compiler versions with 3 digits but ships settings.yml only with 2 digits
Describe the bug
Environment: Windows 11 Conan Versions >= 2.4 up to at least 2.16.1. MinGw Compiler version x.y.z
Conan detects the MinGw compiler version and puts it to the default profile with all 3 digits x.y.z.
Subsequent conan commands fail with an error message like:
ERROR: Invalid setting 'x.y.z' is not a valid 'settings.compiler.version' value.
This is because in the settings.yml all compiler versions are only given with either one or two digits only.
Possible root cause:
With this change: https://github.com/conan-io/conan/pull/16362/commits/c7cd0dfb23d11979a08dd5d72d82934ee6aa4954
There was a “+” sign added in the regex-group:
installed_version = re.search(r" ([0-9]+(\.[0-9])+)", out).group()
When this “+” is changed to a “?” it seems to work as expected again to have only 2 digits in the default profile.
Maybe the intention of the developer was to have the “+” inside the group to allow minor versions >9?
How to reproduce it
- Install a MinGw Compiler with a 3 digit version x.y.z.
- run:
conan profile detect - run then e.g. a proper"conan install" command.
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Allow multi-digit version minors for detected compilers (#18410) Changelog: Fix: Allow minors greater than 9 in detect api Docs: Omit Closes https://github.com/conan-io/conan/issues/18409 — committed to conan-io/conan by memsharded a year ago
- Make older gccs explictily return up to minor, to keep compat with ol… (#18419) Changelog: Fix: Ensure old gcc version are detected up to minor version only Docs: Omit This keeps compat with old Con... — committed to Mu-L/conan by memsharded a year ago
This is being already done, but only for versions gcc < 5. Otherwise only the major is displayed, and this is the expected behavior
Because gcc changed its binary compatibility model in gcc 5, meaning that the minor version from 5.X does not generate binary incompatibilities, while in gcc 4.X, the different 4.8, 4.9 versions could be binary incompatible