{"action":"created","issue":{"url":"https://api.github.com/repos/conan-io/conan/issues/3573","repository_url":"https://api.github.com/repos/conan-io/conan","labels_url":"https://api.github.com/repos/conan-io/conan/issues/3573/labels{/name}","comments_url":"https://api.github.com/repos/conan-io/conan/issues/3573/comments","events_url":"https://api.github.com/repos/conan-io/conan/issues/3573/events","html_url":"https://github.com/conan-io/conan/issues/3573","id":361643342,"node_id":"MDU6SXNzdWUzNjE2NDMzNDI=","number":3573,"title":"Incorrect handling of MSVC versions","user":{"login":"DoDoENT","id":158844,"node_id":"MDQ6VXNlcjE1ODg0NA==","avatar_url":"https://avatars2.githubusercontent.com/u/158844?v=4","gravatar_id":"","url":"https://api.github.com/users/DoDoENT","html_url":"https://github.com/DoDoENT","followers_url":"https://api.github.com/users/DoDoENT/followers","following_url":"https://api.github.com/users/DoDoENT/following{/other_user}","gists_url":"https://api.github.com/users/DoDoENT/gists{/gist_id}","starred_url":"https://api.github.com/users/DoDoENT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoDoENT/subscriptions","organizations_url":"https://api.github.com/users/DoDoENT/orgs","repos_url":"https://api.github.com/users/DoDoENT/repos","events_url":"https://api.github.com/users/DoDoENT/events{/privacy}","received_events_url":"https://api.github.com/users/DoDoENT/received_events","type":"User","site_admin":false},"labels":[{"id":400895537,"node_id":"MDU6TGFiZWw0MDA4OTU1Mzc=","url":"https://api.github.com/repos/conan-io/conan/labels/Feedback%20please!","name":"Feedback please!","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-19T08:50:23Z","updated_at":"2018-09-24T10:18:04Z","closed_at":null,"author_association":"NONE","body":"I am using Conan v1.7.4.\r\n\r\nI've created a static library Conan package using VS 2017 15.7 and updated my Visual Studio to 15.8. After the update, Conan failed to detect a change in the compiler version and did not perform recompilation of the static library. Instead, it just downloaded the same package that was built with VS 2017 15.7. However, when linking to that package from VS 2017 15.8, I am getting following linker error:\r\n\r\n```\r\nLINK : fatal error C1047: The object or library file 'C:\\Users\\dodo\\.conan\\data\\LogAndTimer\\1.0.1\\microblink\\stable\\package\\8b2772668ccbf879d34a70a9d54c78ce70f38a1b\\lib\\LogAndTimer.lib' was created with an older compiler than other objects; rebuild old objects and libraries\r\n2>LINK : fatal error LNK1257: code generation failed\r\n```\r\n\r\nHowever, the debug build does work (details how to reproduce are below).\r\n\r\nI think the problem is in how Conan handles MSVC versions - instead of using the actual compiler version (CMake detects `MSVC 19.14.26431.0` in VS 2017 15.7 and `MSVC 19.15.26729.0` in VS 2017 15.8), it uses the version of Visual Studio (VS 2017 is _compiler version 15_, according to Conan).\r\n\r\nI suggest that Conan should use the MSVC compiler version under `compiler.version` setting and additionally have `compiler.vs_version` for Visual Studio version. The reason for that is that sometimes libraries built with one version of MSVC are not compatible with later versions of MSVC, especially if you use link time code generation flag (`/LTCG` link flag and `/GL` compile flag).\r\n\r\n## How to reproduce\r\n\r\n- Install Visual Studio 2017, but not the latest update (at the time of writing, this is 15.8.4). For example, use VS 2017 15.7.x or 15.6.x.\r\n- Create a conan package that contains a single static library. Make sure that `Release` build type of that package is compiled with `/GL` compile flag.\r\n- Create an application that consumes that static library and make sure it works in `Release` build type (the app should be linked with `/LTCG` linker flag).\r\n- Update Visual Studio 2017 to the latest version (15.8.4 at the time of writing).\r\n- Build your application\r\n\r\n### Expected behaviour\r\n- `conan install` after updating the VS should calculate different hash for the library and should rebuild it, thus making sure application linking will succeed\r\n\r\n### Actual behaviour\r\n- Conan does not detect version change in the MSVC compiler and uses the incompatible binary, thus causing linker error described above.\r\n\r\nNow, the main question is - could this be fixed without breaking existing conan VS packages, or we need to wait for Conan 2.0 (and disable LTCG until this issue gets fixed).\r\n\r\nAlso, as a side question, is there a possibility to configure Conan to trigger rebuild of libraries even when a minor/bugfix version of the compiler changes, regardless of the compiler being used (e.g. if we update GCC from 8.1.0 to 8.1.1, we would like to rebuild all our binaries, even though they are link-compatible). This would get us the benefits of always having binaries built with the latest compiler to get the latest bugfixes and performance improvements - this benefit is also mentioned in [conan documentation](https://docs.conan.io/en/latest/creating_packages/define_abi_compatibility.html#):\r\n\r\n> What happens if we have a library that we can be built with GCC 4.8 and will preserve the ABI compatibility with GCC 4.9? (This kind of compatibility is easier to achieve for example for pure C libraries).\r\n>\r\n> **Although it could be argued that it is worth rebuilding with 4.9 too -to get fixes and performance improvements-.** Let’s suppose that we don’t want to create 2 different binaries, but just a single built with GCC 4.8 which also needs to be compatible for GCC 4.9 installations.\r\n"},"comment":{"url":"https://api.github.com/repos/conan-io/conan/issues/comments/423930284","html_url":"https://github.com/conan-io/conan/issues/3573#issuecomment-423930284","issue_url":"https://api.github.com/repos/conan-io/conan/issues/3573","id":423930284,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzkzMDI4NA==","user":{"login":"lasote","id":3807515,"node_id":"MDQ6VXNlcjM4MDc1MTU=","avatar_url":"https://avatars1.githubusercontent.com/u/3807515?v=4","gravatar_id":"","url":"https://api.github.com/users/lasote","html_url":"https://github.com/lasote","followers_url":"https://api.github.com/users/lasote/followers","following_url":"https://api.github.com/users/lasote/following{/other_user}","gists_url":"https://api.github.com/users/lasote/gists{/gist_id}","starred_url":"https://api.github.com/users/lasote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lasote/subscriptions","organizations_url":"https://api.github.com/users/lasote/orgs","repos_url":"https://api.github.com/users/lasote/repos","events_url":"https://api.github.com/users/lasote/events{/privacy}","received_events_url":"https://api.github.com/users/lasote/received_events","type":"User","site_admin":false},"created_at":"2018-09-24T10:18:04Z","updated_at":"2018-09-24T10:18:04Z","author_association":"CONTRIBUTOR","body":"Normally the base `settings.yml` file is designed as a minimum for the community and so far the visual studio segmentation by 14, 15 worked well. \r\n\r\nIf you need a more accurate model you could:\r\n\r\nA) Introduce a subsetting. If the subsetting has a \"None\" value as a possible value it won't be required, and all the current conan center packages will be compatible. If you give a value to the subsetting, you will be generating a new package_id.\r\n\r\nB) Change the list of versions including the minor (15.8) but keeping the \"15\" value. So the old packages will still be \"usable\" if a user specifies just \"15\" but you can generate more accurate binaries for the users specifying \"15.8\". But probably we would need to check the conan code to search all the Visual Studio version setting comparison to ensure \"15.8\" is processed correctly, the CMake checks etc.\r\n\r\nI think the correct is the B) and might be the way to go, even if by default Conan detects \"15\" instead of \"15.8\".\r\n\r\nBUT, of course, this is something the community can give feedback, I see **many** upvotes. Are they friends/colleagues of you? or is the whole community really demanding a better approach? ;)\r\n\r\n@memsharded feedback is needed here too.\r\n"}}
{"actor":{"display_login":"lasote"}}