-
Notifications
You must be signed in to change notification settings - Fork 985
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
fixing msvc version model (breaking) #10057
fixing msvc version model (breaking) #10057
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All in all - if all this is just to fix the version comparison, then I think it will introduce more problems than it will solve (see my comments regarding the special cases for VS 16.9 and VS 16.11).
Wouldn't be much simpler to perform version comparison by removing all dots from the version string and replacing all X
with 0
and then converting that to an integer? Thus, 19.3X
would be converted to 1930
and would be larger than 19.22
which would be treated as 1922
.
Note that even the current model didn't correctly handle the VS 16.9 and 16.11, as I warned about back in March
compiler_update = str(settings.compiler.update) | ||
if compiler_update != "None": # It is full one(19.28), not generic 19.2X | ||
# The equivalent of compiler 19.26 is toolset 14.26 | ||
return "version=14.{}{}".format(compiler_version[-1], compiler_update) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not correctly handle special cases for VS 16.9 and VS 16.11, which need 3-part version number to be selected correctly. See this thread for more information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This piece of code will handle whatever you have defined in your msvc
compiler.update
. If you define your updates as 9.XX
and 9.YY
(which you can easily add to the default settings.yml
) to differentiate those different cases, this would work wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 , it should work. Excellent idea! So, for VS 16.8 I would need to add "8.29333" and for VS 16.10 "9.30037".
Seems elegant enough to even be part of the default settings.yml
😊
# The equivalent of compiler 19.26 is toolset 14.26 | ||
vcvars_ver = "14.{}".format(minor[0]) | ||
# The equivalent of compiler 192 is toolset 14.2 | ||
vcvars_ver = "14.{}".format(compiler_version[-1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above. Need to take care of special cases for VS 16.9 and VS 16.11.
"19.2X", "19.20", "19.21", "19.22", "19.23", "19.24", "19.25", "19.26", "19.27", "19.28", "19.29", | ||
"19.3X", "19.30"] | ||
version: [190, 191, 192, 193] | ||
update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment. VS 16.8 and 16.9 both have "update 8", yet those are link-incompatible. Same stands for VS 16.10 and 16.11 (both are "update 9"). You need to handle that case as well.
"19.2X", "19.20", "19.21", "19.22", "19.23", "19.24", "19.25", "19.26", "19.27", "19.28", "19.29", | ||
"19.3X", "19.30"] | ||
version: [190, 191, 192, 193] | ||
update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above.
We already have this merged in |
I still don't fully see a complete solution, the issue is indeed complex and information from Msft in threads like https://developercommunity.visualstudio.com/t/How-to-select-VS-168-compiler-with-vcva/1359197 are not fully clarifying. Lets summarize the overall requirements to define our settings.yml for
What would be then @DoDoENT your proposal in |
I am missing some context here. you already proposed another fix a few days ago: #10028 |
Yes, 19.3X does not compare correctly with other versions, e.g "19.3X" < "19.21" => True. yes, I know this sounds like a bug, difficult to change in Conan 1.X. But even if we change it, having "19.3X" > "19.31" => True will still be incorrect, and would lead to incorrect user conditions in recipes. Problem with Regarding Some of the main users of the |
that's basically a set that couldn't be ordered and comparison operators don't apply to (all of) its elements. you can compare I would probably just have two distinct sets of versions: just a raw idea. maybe it should be a (sub) different setting, or different compiler. |
This is how it currently looks like in my
Note that we still haven't migrated to using new
In general, your proposed model should work and cover all those cases, except special cases for VS 16.9 and VS 16.11. However, those could be added as special I've added comments about that in the above PR review because I have the fear of the following scenario:
Currently, with the However, with Since we don't know what else will Microsoft throw at us in their future updates, maybe it would be best to provide a conan hook for setting up the vcvars? If the hook is set, use it, if it's not, fall back to the heuristics that you've already implemented. Then, each organization can define its own hooks that will best suit its build environments. |
I don't think we have to cover these cases necessarily. If you are concerned about these incompatibilities and you have generated binaries with both Visual Studio versions you can always alter the settings as you did. The default settings file is for the majority of the people/community at conan center. I think it would be better to have a correct version model that we can compare and not hard the model for these corner cases. |
I agree - but this means that I then need to have the ability to prevent conan from calling vcvars batch script (because it will do it incorrectly). That is all I need and this is also the current behavior (Conan detects the vcvars are set and does nothing). |
Changelog: Fix: Fix the
msvc
version model, which is comparison broken with the "main" 19.3 version < 19.22.Docs: conan-io/docs#2314
cc @mpusz, @DoDoENT