Bug 405662

Summary: Add MSVS 2019 support + fix nits
Product: [Developer tools] Craft Reporter: Ross Boylan <Ross.Boylan>
Component: CoreAssignee: Hannah von Reth <vonreth>
Status: RESOLVED FIXED    
Severity: wishlist CC: jk.kdedev, kare.sars, kde-windows
Priority: NOR    
Version: master   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Ross Boylan 2019-03-19 20:11:08 UTC
SUMMARY

Please add support for MS Visual Studio 2019, currently available in preview and RC and scheduled for release April 2 (https://devblogs.microsoft.com/visualstudio/visual-studio-2019-release-candidate-rc-now-available/)

Along the way I encountered some documentation and error handling that I think can be improved on.

STEPS TO REPRODUCE
1. Following https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Windows setup powershell and start installation.
2. The script asks to choose a compiler and MSVS 2019 is not on the list.
That completes the steps to reproduce.  I pressed on, selecting MSVS 2017, which is not on my system.

OBSERVED RESULT
VS2019 was not a choice.
After continuing with 2017 I got the message

Execute: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe c:\Users\rdboylan\Documents\src\CraftRoot\craft-master\bin\craft.py craft
Please ensure that you have installed the C++ component

and it stopped.


EXPECTED RESULT

Well, I kind of expected it to fail :)  But it would have been nice if it didn't.

I also expected it would be clear whether or not the installation succeeded; it was not.  That is, the final message sounded as if it could be recommended post-installation setup.  It was also very unclear what exactly was being referred to.

Based on looking at the code I'm pretty sure this was a failure.  The likely immediate cause was that VCTOOLSREDISTDIR was not set.  This was partly because the instructions noted above do not refer to it until AFTER the instructions to install craft.  Whether setting it will be sufficient to proceed I don't know; I'll try as soon as I figure the best way to restart.

In short:
1. Main issue: Add support for VS 2019

Secondary issues:
2. If installation fails, make it clear it has failed.
3. The message "Please ensure that you have installed the C++ component" could be more explicit about what exactly is missing and how it needs to be installed.
4. Instructions at https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Windows should specify steps in the order in which they are performed, i.e., set env variables before running script.  Better yet, the script could handle this itself, minimally by warning if a needed environment variable is missing and maximally by setting it appropriately.  FWIW, I believe with my current installation C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Redist\MSVC\14.20.27404 is the right value.  I believe $env:VCTOOLSREDISTDIR= "..." is the right way to set it.


SOFTWARE/OS VERSIONS
Windows: 10 64 bit; MSVS 2019 Preview

ADDITIONAL INFORMATION
Note the installer did find the Python3.7 that was installed as part of VS.

I was doing this to build kdiff3.
Comment 1 Ross Boylan 2019-03-20 06:46:59 UTC
After a lot of hacking, I have changes that might be appropriate.  I still haven't a completely successful install, but the reasons appear unrelated.

What is the best way to communicate the changes?  They are in a branch in git in my local machine; I cloned from github, but I thought I read that is read-only.

Some of the changes permit identification of pre-release versions of MSVS, which are otherwise invisible.
Ross
Comment 2 Kåre Särs 2019-03-20 07:53:37 UTC
The preferred way to contribute (at the moment) is to do a review-request on phabricator.kde.org

If you want to use the web-interface: https://phabricator.kde.org/differential/diff/create/

Upload the patch, select the proper repository and create the diff and describe the changes.


Alternatively you can use arcanist (https://secure.phabricator.com/book/phabricator/article/arcanist/)
Comment 3 Ross Boylan 2019-03-21 03:08:48 UTC
See https://phabricator.kde.org/D19933 for the patch.
Comment 4 Julius Künzel 2024-03-16 18:51:58 UTC
Meanwhile we use MSVC2019 for Qt5 and MSVC2022 for Qt6